-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
30 lines (23 loc) · 873 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
FROM rust:1.73 as build
RUN USER=root cargo new --bin rocky
WORKDIR rocky
# Copy deps info and build app depedencies
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
RUN cargo build --release && rm src/*.rs
# delete app bin that previously build and build real app bin
COPY ./src ./src
RUN rm ./target/release/deps/rocky*
RUN cargo build --release
# Second Stage
from debian:bookworm-slim
## TODO: needs to statically link openssl to the build, to decrease image size (musl)
## Install shared object needed for rocky (libssl-dev)
RUN apt-get update && \
apt-get install -y --no-install-recommends libssl-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /usr/share/man /usr/share/doc /usr/share/doc-base
# Copy rocky bin and default configuration
COPY --from=build /rocky/target/release/rocky .
COPY ./rocky.toml .
CMD ["./rocky"]