-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDockerfile
27 lines (21 loc) · 895 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
FROM ahmetozer/golang
WORKDIR /go/src/github.com/ahmetozer/net-tools-service
COPY . .
# Get dependencies
RUN go get -d -v ./...
RUN go install -v ./...
# build
RUN CGO_ENABLED=0 go build -o /bin/net-tools-service
# Switch to server ENV
FROM ubuntu
LABEL org.opencontainers.image.source https://github.com/ahmetozer/net-tools-service
# Get all required packages
RUN export DEBIAN_FRONTEND=noninteractive; apt update; apt install iputils-ping traceroute dnsutils whois ca-certificates curl mtr-tiny libcap2-bin --no-install-recommends -y ; apt clean;apt autoclean
# COPY Binary and service file
COPY --from=0 /bin/net-tools-service /bin/net-tools-service
COPY services /etc/services
# To allow net-tools-service to bind port root ports like a 443
RUN setcap CAP_NET_BIND_SERVICE=+eip /bin/net-tools-service
# switch user to www-data
USER www-data
ENTRYPOINT ["/bin/net-tools-service"]