-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
40 lines (28 loc) · 1.09 KB
/
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
39
40
FROM debian:bullseye-slim as builder
LABEL description="This is the build stage for Index-daemon. Here we create the binary."
ARG PROFILE=release
WORKDIR /app
ADD . .
RUN apt-get update && \
apt-get dist-upgrade -y -o Dpkg::Options::="--force-confold" && \
apt-get install -y cmake pkg-config libssl-dev git clang curl
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
export PATH="$PATH:$HOME/.cargo/bin" && \
cargo build "--$PROFILE"
# ===== SECOND STAGE ======
FROM debian:bullseye-slim
LABEL description="This is the 2nd stage: a very small image where we copy the Index-daemon binary."
ARG PROFILE=release
COPY --from=builder /app/target/$PROFILE/index-daemon /usr/local/bin
RUN apt-get update \
&& apt-get -y install make openssh-client ca-certificates && update-ca-certificates
RUN mv /usr/share/ca* /tmp && \
rm -rf /usr/share/* && \
mv /tmp/ca-certificates /usr/share/
# checks
RUN ldd /usr/local/bin/index-daemon && \
/usr/local/bin/index-daemon --version
# Shrinking
RUN rm -rf /usr/lib/python* && \
rm -rf /usr/bin /usr/sbin /usr/share/man
CMD ["/usr/local/bin/index-daemon"]