forked from metacontroller/metacontroller
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.debug
23 lines (18 loc) · 933 Bytes
/
Dockerfile.debug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
FROM golang:1.18.2 AS build
ARG TAG
ENV TAG=${TAG:-dev}
ENV CGO_ENABLED=0
COPY . /go/src/metacontroller/
WORKDIR /go/src/metacontroller/
ENV ADDITIONAL_BUILD_ARGUMENTS='-gcflags="all=-N -l"'
RUN make install
RUN go install github.com/go-delve/delve/cmd/dlv@latest
FROM alpine:3.16.0@sha256:686d8c9dfa6f3ccfc8230bc3178d23f84eeaf7e457f36f271ab1acc53015037c
RUN apk update && apk add --no-cache ca-certificates
COPY --from=build /go/bin/metacontroller /usr/bin/metacontroller
COPY --from=build /go/bin/dlv /
# Run container as nonroot, use the same uid and naming convention as distroless images
# See https://github.com/GoogleContainerTools/distroless/blob/0d757ece34cdc83a2148cea6c697e262c333cb84/base/base.bzl#L8
RUN addgroup -g 65532 -S nonroot && adduser -D -u 65532 -g nonroot -S nonroot -G nonroot
USER nonroot:nonroot
CMD ["/dlv", "--listen=:40000", "--headless=true", "--api-version=2", "exec", "/usr/bin/metacontroller"]