-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
42 lines (35 loc) 路 1.04 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
41
42
FROM debian:latest AS builder
ARG GITHUB_SHA="${GITHUB_SHA}"
LABEL com.goatns.git-commit="${GITHUB_SHA}"
# fixing the issue with getting OOMKilled in BuildKit
ENV CARGO_NET_GIT_FETCH_WITH_CLI=true
RUN mkdir /goatns
COPY . /goatns/
WORKDIR /goatns
# install the dependencies
RUN apt-get update && apt-get install -y \
protobuf-compiler \
curl \
git \
build-essential \
pkg-config \
libssl-dev
# install rust
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
RUN mv /root/.cargo/bin/* /usr/local/bin/
# do the build bits
RUN cargo build --release --bin goatns
RUN chmod +x /goatns/target/release/goatns
FROM gcr.io/distroless/cc-debian12 AS goatns
# # ======================
# https://github.com/GoogleContainerTools/distroless/blob/main/examples/rust/Dockerfile
COPY --from=builder /goatns/target/release/goatns /
COPY --from=builder /goatns/static_files /static_files
# DNS ports
# EXPOSE 15353/udp
# EXPOSE 15353/tcp
# default web API port
# EXPOSE 9000/udp
WORKDIR /
USER nonroot
ENTRYPOINT ["./goatns"]