Files
toollist/Dockerfile
T
Oliver Walter 4d1133a33e
Build & Push Docker Image / Build and push (push) Failing after 17m10s
docker workflow
2026-06-06 16:14:02 +02:00

53 lines
1.7 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# ─── 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"]