formies/Dockerfile

21 lines
534 B
Docker
Raw Normal View History

2025-01-03 10:26:04 +01:00
# Stage 1: Build the Svelte frontend
2024-12-27 14:05:56 +01:00
FROM node:18 as frontend-builder
2025-01-03 10:26:04 +01:00
WORKDIR /app/frontend
COPY frontend/ .
2024-12-27 14:05:56 +01:00
RUN npm install
RUN npm run build
2025-01-03 10:26:04 +01:00
# Stage 2: Build the Rust backend
2025-01-03 10:45:33 +01:00
FROM rust:1.83 as backend-builder
2025-01-03 10:26:04 +01:00
WORKDIR /app/backend
COPY backend/ .
2024-12-27 14:05:56 +01:00
RUN cargo build --release
2025-01-03 10:26:04 +01:00
# Final Stage: Combine frontend and backend
2024-12-27 14:05:56 +01:00
FROM debian:bullseye-slim
WORKDIR /app
2025-01-03 10:26:04 +01:00
COPY --from=frontend-builder /app/frontend/build ./frontend/dist
2025-01-03 11:40:16 +01:00
COPY --from=backend-builder /app/backend/target/release/formies_be ./formies_be
2024-12-27 14:05:56 +01:00
EXPOSE 8080
CMD ["./backend"]