-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
33 lines (21 loc) · 841 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 docker.io/rust:1-slim-bookworm AS build
ARG pkg=railways-server-website
RUN apt-get update && apt-get install -y pkg-config libssl-dev
WORKDIR /build
COPY backend/ .
RUN --mount=type=cache,target=/build/target \
--mount=type=cache,target=/usr/local/cargo/registry \
--mount=type=cache,target=/usr/local/cargo/git \
set -eux; \
cargo build --release; \
objcopy --compress-debug-sections target/release/$pkg ./main
################################################################################
FROM docker.io/debian:bookworm-slim
RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/*
WORKDIR /app
## Copy the main binary
COPY --from=build /build/main ./
## Ensure the container listens globally on port 8080
ENV ROCKET_ADDRESS=0.0.0.0
ENV ROCKET_PORT=8080
CMD ["./main"]