-
Notifications
You must be signed in to change notification settings - Fork 4
/
Dockerfile-udigd
36 lines (24 loc) · 964 Bytes
/
Dockerfile-udigd
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
# syntax = docker/dockerfile:1-experimental@sha256:600e5c62eedff338b3f7a0850beb7c05866e0ef27b2d2e8c02aa468e78496ff5
ARG GO_VERSION=1.21
FROM golang:${GO_VERSION}-bullseye AS builder
WORKDIR /src
ENV CGO_ENABLED=0
COPY go.* .
RUN --mount=type=cache,target=/go/pkg go mod download -x
COPY ./ ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/go/pkg \
go build -o /udig ./cmd/udigd
# is this still necessary?
RUN apt-get update && apt-get install --yes libcap2-bin
RUN setcap 'cap_net_bind_service+eip' /udig
# distroless with busybox
FROM gcr.io/distroless/base@sha256:e9d0321de8927f69ce20e39bfc061343cce395996dfc1f0db6540e5145bc63a5
COPY --from=builder /udig /udig
COPY --from=builder /sbin/getcap /sbin
COPY --from=builder /sbin/setcap /sbin
COPY --from=builder /lib/*-linux-gnu/libcap.so.2 /lib
RUN ["/sbin/setcap", "cap_net_bind_service=+ep", "/udig"]
EXPOSE 8053/udp
USER 1000:1000
ENTRYPOINT ["/udig"]