-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
38 lines (30 loc) · 933 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
36
37
38
###################
### BUILD STAGE ###
###################
FROM rust:1.82 as build
WORKDIR /usr/src/
# Install build-target for static linking
RUN rustup target add x86_64-unknown-linux-musl
# Create a dummy binary for pre-compiling dependencies (for caching)
RUN cargo new --bin digit-web
WORKDIR /usr/src/digit-web
RUN cargo build --release --target x86_64-unknown-linux-musl
# Copy the actual source files
COPY Cargo.toml Cargo.lock ./
COPY src ./src
# Compile the final binary
RUN cargo build --release --target x86_64-unknown-linux-musl
########################
### PRODUCTION STAGE ###
########################
FROM scratch
WORKDIR /
EXPOSE 9999
ENV ROCKET_PORT="9999"
ENV ROCKET_ADDRESS="0.0.0.0"
ENV ROCKET_IDENT="UwU? notices client OwO"
COPY data ./data/
COPY templates ./templates/
COPY static/ ./static/
COPY --from=build /usr/src/digit-web/target/x86_64-unknown-linux-musl/release/digit2021 ./app
CMD ["./app"]