docker workflow
Build & Push Docker Image / Build and push (push) Failing after 17m10s

This commit is contained in:
Oliver Walter
2026-06-06 16:14:02 +02:00
parent 5f43c19878
commit 4d1133a33e
8 changed files with 326 additions and 0 deletions
+52
View File
@@ -0,0 +1,52 @@
# ─── Stage 1: Builder ────────────────────────────────────────────────────────
FROM rust:1.96 AS builder
WORKDIR /app
# System deps needed to compile OpenSSL and link the binary
RUN apt-get update && apt-get install -y \
pkg-config \
libssl-dev \
&& rm -rf /var/lib/apt/lists/*
# Add the WASM compilation target required by cargo-leptos
RUN rustup target add wasm32-unknown-unknown
# Install cargo-leptos (pinned for reproducibility).
# Done BEFORE copying source so this expensive step is cached
# as a separate layer and only re-runs when the Dockerfile changes.
RUN cargo install cargo-leptos --locked
# Copy the full source tree (respects .dockerignore).
# Everything above this line is layer-cached by Docker / the CI cache.
COPY . .
# Build server binary + WASM/CSS/JS site bundle in release mode
RUN cargo leptos build --release
# ─── Stage 2: Runtime ────────────────────────────────────────────────────────
FROM debian:bookworm-slim AS runtime
WORKDIR /app
RUN apt-get update && apt-get install -y \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# Server binary
COPY --from=builder /app/target/release/toollist ./toollist
# JS / WASM / CSS site bundle (default site-root = "target/site")
COPY --from=builder /app/target/site ./target/site
# Cargo.toml is read at startup by leptos get_configuration()
COPY --from=builder /app/Cargo.toml ./Cargo.toml
# Seed data in production this directory is mounted as a volume
COPY --from=builder /app/data ./data
EXPOSE 3000
ENV LEPTOS_ENV=PROD
CMD ["./toollist"]