-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (23 loc) · 858 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
FROM messense/rust-musl-cross:x86_64-musl as chef
RUN cargo install cargo-chef
WORKDIR /a-flying-hat
FROM chef AS planner
# Copy source code from previous stage
COPY . .
# Generate info for caching dependencies
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /a-flying-hat/recipe.json recipe.json
# Build & cache dependencies
RUN cargo chef cook --release --target x86_64-unknown-linux-musl --recipe-path recipe.json
# Copy source code from previous stage
COPY . .
# Build application
RUN cargo build --release --target x86_64-unknown-linux-musl
# Create a new stage with a minimal image
FROM scratch
COPY --from=builder /a-flying-hat/target/x86_64-unknown-linux-musl/release/a-flying-hat /app/a-flying-hat
# Copy the public directory
COPY ./public /app/public
ENTRYPOINT ["/app/a-flying-hat"]
EXPOSE 8080