27 lines
681 B
Docker
27 lines
681 B
Docker
# Build frontend
|
|
FROM node:20-alpine AS frontend-build
|
|
WORKDIR /app
|
|
COPY frontend/package.json frontend/package-lock.json ./
|
|
RUN npm ci
|
|
COPY frontend/ .
|
|
RUN npm run build
|
|
|
|
# Build Rust backend
|
|
FROM rust:1.75 AS rust-builder
|
|
WORKDIR /app
|
|
COPY Cargo.toml Cargo.lock ./
|
|
COPY src/ ./src/
|
|
RUN cargo build --release
|
|
RUN cp target/release/hello-web /app/hello-web
|
|
|
|
# Final image
|
|
FROM debian:bookworm-slim
|
|
RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
ca-certificates \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
WORKDIR /app
|
|
COPY --from=rust-builder /app/hello-web /app/hello-web
|
|
COPY --from=frontend-build /app/dist /app/frontend/dist
|
|
EXPOSE 3000
|
|
CMD ["/app/hello-web"]
|