-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathContainerfile
More file actions
38 lines (28 loc) · 925 Bytes
/
Containerfile
File metadata and controls
38 lines (28 loc) · 925 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# Stage 1: Build the Vue.js frontend
FROM node:25 AS frontend-builder
COPY assets/logo.png /app/assets/logo.png
WORKDIR /app/frontend
COPY frontend/package*.json ./
RUN npm install
COPY frontend/ ./
RUN npm run build
# Stage 2: Build the Rust backend binary
FROM rust:1.94 AS backend-builder
ARG RUN_TESTS=false
WORKDIR /app/backend
COPY backend/ ./
RUN cargo build --release --locked \
&& cp target/release/backend backend \
&& if [ "$RUN_TESTS" = "true" ]; then \
cargo test --features test-mode; \
else \
echo "Skipping tests"; \
fi
# Stage 3 Final container with Nginx and backend binary
FROM nginx:stable
WORKDIR /app/data
COPY --from=frontend-builder /app/frontend/dist/ /usr/share/nginx/html/
COPY container/nginx.conf /etc/nginx/nginx.conf
COPY --from=backend-builder /app/backend/backend /app/bin/backend
EXPOSE 80
CMD ["/bin/sh", "-c", "nginx && /app/bin/backend"]