-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDockerfile
More file actions
31 lines (28 loc) · 1016 Bytes
/
Copy pathDockerfile
File metadata and controls
31 lines (28 loc) · 1016 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
# build frontend into /app/frontend/dist
FROM node:26 AS build-frontend
COPY frontend /app/frontend
WORKDIR /app/frontend
RUN --mount=type=cache,target=/app/frontend/node_modules \
npm install
RUN --mount=type=cache,target=/app/frontend/node_modules \
npm run build
# output backend binary in /app/web
FROM rust:1.98 AS build-backend
COPY backend /app/backend
WORKDIR /app/backend
RUN --mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/app/backend/target \
cargo build --release --bin web && \
cp target/release/web /app/web
FROM debian:stable-slim
EXPOSE 8000
HEALTHCHECK --interval=1m --timeout=3s --start-interval=1s --start-period=30s \
CMD curl --fail http://127.0.0.1:8000/ || exit 1
RUN apt update && apt install -y curl && rm -rf /var/lib/apt/lists/*
COPY --from=build-backend /app/web /app/
COPY --from=build-frontend /app/frontend/dist /app/dist
WORKDIR /app
ENV RUST_LOG=info
ENV ROCKET_LOG_LEVEL=normal
ENV ROCKET_ADDRESS=0.0.0.0
CMD ["/app/web"]