From 67b0e4ebd7cf61f1705f5bb2be2adc559bd83d57 Mon Sep 17 00:00:00 2001 From: Eric Neuber Date: Tue, 17 Feb 2026 23:20:46 +0100 Subject: [PATCH] Anpassung Pipeline und Dockerfile --- .gitea/workflows/docker.yml | 31 ++++++++++++++++++++++++++++ .vscode/launch.json | 2 +- Cargo.lock | 40 ++++++++++++++++++------------------- Cargo.toml | 4 ++-- Dockerfile | 25 +++++++---------------- README.md | 34 ++++++------------------------- VERSION | 1 + 7 files changed, 68 insertions(+), 69 deletions(-) create mode 100644 .gitea/workflows/docker.yml create mode 100644 VERSION diff --git a/.gitea/workflows/docker.yml b/.gitea/workflows/docker.yml new file mode 100644 index 0000000..40854da --- /dev/null +++ b/.gitea/workflows/docker.yml @@ -0,0 +1,31 @@ +name: Build Docker Image (Podman) + +on: + push: + branches: [ main ] + pull_request: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Install Podman + run: sudo apt-get update && sudo apt-get install -y podman + - name: Checkout code + uses: actions/checkout@v3 + - name: Set version in Cargo.toml + run: | + VERSION=$(cat VERSION) + sed -i "s/^version = \"__VERSION__\"/version = \"$VERSION\"/" Cargo.toml + - name: Build image with Podman + run: | + VERSION=$(cat VERSION) + podman build -t paramod:latest -t git.skaville.rocks/eneuber/paramod:$VERSION . + - name: Login to Gitea Registry + run: echo ${{ secrets.REGISTRY_TOKEN }} | podman login -u ${{ secrets.USER }} --password-stdin git.skaville.rocks + - name: Push image with version + run: | + VERSION=$(cat VERSION) + podman push git.skaville.rocks/eneuber/paramod:$VERSION + - name: Push image latest + run: podman push git.skaville.rocks/eneuber/paramod:latest \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 4bb63b0..26c80af 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -5,7 +5,7 @@ "name": "Debug main.rs", "type": "lldb", "request": "launch", - "program": "${workspaceFolder}/target/debug/table-server", + "program": "${workspaceFolder}/target/debug/paramod", "args": [], "cwd": "${workspaceFolder}", "sourceLanguages": ["rust"], diff --git a/Cargo.lock b/Cargo.lock index bf5605a..8a1b888 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1317,6 +1317,26 @@ dependencies = [ "hashbrown 0.14.5", ] +[[package]] +name = "paramod" +version = "0.3.0" +dependencies = [ + "actix-files", + "actix-web", + "chrono", + "config", + "influxdb", + "rumqttc", + "serde", + "serde_derive", + "serde_json", + "serde_yaml", + "tera", + "tokio", + "tokio-modbus", + "toml", +] + [[package]] name = "parking_lot" version = "0.12.5" @@ -2050,26 +2070,6 @@ dependencies = [ "libc", ] -[[package]] -name = "table-server" -version = "0.1.0" -dependencies = [ - "actix-files", - "actix-web", - "chrono", - "config", - "influxdb", - "rumqttc", - "serde", - "serde_derive", - "serde_json", - "serde_yaml", - "tera", - "tokio", - "tokio-modbus", - "toml", -] - [[package]] name = "tera" version = "1.20.1" diff --git a/Cargo.toml b/Cargo.toml index 03b9a07..989b211 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "table-server" -version = "0.1.0" +name = "paramod" +version = "__VERSION__" edition = "2021" [dependencies] diff --git a/Dockerfile b/Dockerfile index d1eff67..8b875e1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,44 +1,33 @@ + # Build Stage -FROM rust:1.75 as builder +FROM rust:1.81 as builder WORKDIR /usr/src/app -# Copy manifest files COPY Cargo.toml ./ - -# Copy source code and templates +COPY Cargo.lock ./ COPY src ./src COPY templates ./templates COPY static ./static -# Build the application RUN cargo build --release # Runtime Stage FROM debian:bookworm-slim -# Install required dependencies RUN apt-get update && apt-get install -y \ ca-certificates \ && rm -rf /var/lib/apt/lists/* WORKDIR /app -# Copy the binary from builder -COPY --from=builder /usr/src/app/target/release/table-server /app/table-server - -# Copy templates and static files +COPY --from=builder /usr/src/app/target/release/paramod /app/paramod COPY --from=builder /usr/src/app/templates /app/templates COPY --from=builder /usr/src/app/static /app/static +COPY paramod.yaml /app/paramod.yaml -# Create directory for config file -RUN mkdir -p /app/data - -# Expose port EXPOSE 8080 -# Set environment to use the data directory -ENV CONFIG_PATH=/app/data/table_config.json +ENV CONFIG_PATH=/app/paramod.yaml -# Run the binary -CMD ["/app/table-server"] +CMD ["/app/paramod"] diff --git a/README.md b/README.md index ec8f416..a6cd369 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ Ein einfacher Rust-Webserver, der eine editierbare 3x3-Tabelle bereitstellt und ## Projektstruktur ``` -table-server/ +paramod/ ├── src/ │ └── main.rs ├── templates/ @@ -46,8 +46,8 @@ table-server/ ```bash # Projekt erstellen -cargo new table-server -cd table-server +cargo new paramod +cd paramod # Dependencies installieren und starten cargo run @@ -60,39 +60,17 @@ Der Server läuft dann auf `http://localhost:8080` ### Container bauen ```bash -docker build -t table-server . +podman build -t paramod . ``` ### Container starten ```bash -docker run -p 8080:8080 -v $(pwd)/data:/app/data table-server +poddman run -p 8080:8080 -v $(pwd)/data:/app/data paramod ``` Mit Volume-Mount bleibt die Konfigurationsdatei auch nach Container-Neustarts erhalten. -### Docker Compose (optional) - -Erstelle eine `docker-compose.yml`: - -```yaml -version: '3.8' - -services: - table-server: - build: . - ports: - - "8080:8080" - volumes: - - ./data:/app/data - restart: unless-stopped -``` - -Starten mit: -```bash -docker-compose up -d -``` - ## Verwendung 1. Öffne `http://localhost:8080` im Browser @@ -110,7 +88,7 @@ docker-compose up -d - MQTT: Toggle-Schalter für MQTT-Aktivierung - InfluxDB: Toggle-Schalter für InfluxDB-Aktivierung 4. **💾 Speichern**: Änderungen persistieren -5. Alle Daten werden zentral in `table_config.json` gespeichert +5. Alle Daten werden zentral in `paramod.yaml` gespeichert ## API Endpoints diff --git a/VERSION b/VERSION new file mode 100644 index 0000000..9325c3c --- /dev/null +++ b/VERSION @@ -0,0 +1 @@ +0.3.0 \ No newline at end of file