-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathwebsite.Dockerfile
More file actions
38 lines (25 loc) · 978 Bytes
/
website.Dockerfile
File metadata and controls
38 lines (25 loc) · 978 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
32
33
34
35
36
37
38
FROM docker.io/rust:1-slim-bookworm AS build
WORKDIR /build
COPY . .
RUN apt update && apt install -y libssl-dev pkg-config
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; \
export SQLX_OFFLINE=true; \
cargo build --release --package website; \
objcopy --compress-debug-sections target/release/website ./main
################################################################################
FROM docker.io/debian:bookworm-slim
WORKDIR /app
RUN apt update && apt install -y libssl3 ca-certificates curl
COPY --from=build /build/website/Rocket.toml ./
## copy the main binary
COPY --from=build /build/main ./
COPY --from=build /build/website/static ./static
COPY --from=build /build/website/templates ./templates
## ensure the container listens globally on port 8080
ENV ROCKET_ADDRESS=::
ENV ROCKET_PORT=8080
EXPOSE 8080
CMD ./main