33 lines
858 B
Docker
33 lines
858 B
Docker
# ---- Builder Stage (Frontend WASM) ----
|
|
FROM rust:alpine AS frontend-builder
|
|
|
|
RUN apk add --no-cache musl-dev
|
|
RUN rustup target add wasm32-unknown-unknown
|
|
RUN cargo install trunk --version 0.22.0-beta.1 --locked
|
|
|
|
WORKDIR /app
|
|
|
|
# Copy workspace definition and lock file for dependency caching
|
|
COPY services/frontend/Cargo.toml services/frontend/Cargo.lock ./
|
|
|
|
# Copy shared-types library
|
|
COPY services/frontend/shared-types ./shared-types/
|
|
|
|
# Copy frontend source
|
|
COPY services/frontend/frontend ./frontend/
|
|
|
|
# Build WASM bundle via trunk
|
|
RUN cd frontend && trunk build --release
|
|
|
|
# ---- Runner Stage ----
|
|
FROM nginx:alpine
|
|
|
|
COPY infra/docker/nginx/nginx.conf /etc/nginx/conf.d/default.conf
|
|
|
|
# Copy frontend static files from builder stage
|
|
COPY --from=frontend-builder /app/frontend/dist /usr/share/nginx/html
|
|
|
|
EXPOSE 80
|
|
|
|
CMD ["nginx", "-g", "daemon off;"]
|