-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
42 lines (28 loc) · 757 Bytes
/
Dockerfile
File metadata and controls
42 lines (28 loc) · 757 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
39
40
41
42
FROM rust:slim AS builder
RUN cargo new --bin dns-hole
WORKDIR /dns-hole
COPY ./Cargo.lock ./Cargo.lock
COPY ./Cargo.toml ./Cargo.toml
RUN cargo build --release \
&& rm src/*.rs target/release/deps/dns_hole*
COPY ./src ./src
RUN cargo build --release
ENV USER=dns-hole
ENV UID=10001
RUN adduser \
--disabled-password \
--gecos "" \
--home "/nonexistent" \
--shell "/sbin/nologin" \
--no-create-home \
--uid "${UID}" \
"${USER}"
FROM gcr.io/distroless/cc
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 /dns-hole
COPY --from=builder /dns-hole/target/release/dns-hole ./dns-hole
USER dns-hole:dns-hole
CMD ["/dns-hole/dns-hole"]