-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
35 lines (24 loc) · 834 Bytes
/
Dockerfile
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
FROM lukemathwalker/cargo-chef:latest-rust-1 AS chef
WORKDIR /source
# Using a separate prepare stage here to cache our dependencies
FROM chef AS build-server-prepare
COPY ./server-rs .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS build-server
COPY --from=build-server-prepare /source/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY ./server-rs .
ARG VERSION=UNKNOWN
RUN cargo build --config "env.VERSION = \"${VERSION}\"" --release
FROM node:20 AS build-ui
WORKDIR /source
COPY ./ui/package.json package.json
COPY ./ui/package-lock.json package-lock.json
RUN npm install
COPY ui .
RUN npm run build
FROM debian:bookworm-slim AS runtime
WORKDIR /app
COPY --from=build-server /source/target/release .
COPY --from=build-ui /source/dist wwwroot
ENTRYPOINT ["./server-rs"]