forked from MarcelCoding/zia
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
50 lines (34 loc) · 947 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# why not slim: tikv_jemallocator needs make, make is not in slim
FROM rustlang/rust:nightly AS chef
RUN update-ca-certificates
RUN cargo install cargo-chef
WORKDIR /zia
FROM chef AS planner
COPY . .
RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
ARG COMPONENT
ENV USER=zia
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
COPY --from=planner /zia/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json
COPY . .
RUN cargo build --release --package zia-${COMPONENT}
FROM gcr.io/distroless/cc
ARG COMPONENT
ENV LISTEN_ADDR=0.0.0.0:3000
EXPOSE 3000
COPY --from=builder /etc/passwd /etc/passwd
COPY --from=builder /etc/group /etc/group
WORKDIR /zia
COPY --from=builder /zia/target/release/zia-${COMPONENT} ./zia
USER zia:zia
ENTRYPOINT ["/zia/zia"]