-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
38 lines (25 loc) · 886 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
28
29
30
31
32
33
34
35
36
37
38
FROM golang:1.22.4 as builder
RUN mkdir -p /gk/
WORKDIR /gk
COPY . .
RUN go mod download
RUN go test -v -race ./...
RUN GIT_COMMIT=$(git describe --dirty --always) && \
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
-X github.com/imorph/gate-keeper/pkg/version.revision=${GIT_COMMIT}" \
-a -o bin/gk cmd/gk/*
RUN GIT_COMMIT=$(git describe --dirty --always) && \
CGO_ENABLED=0 GOOS=linux go build -ldflags "-s -w \
-X github.com/imorph/gate-keeper/pkg/version.revision=${GIT_COMMIT}" \
-a -o bin/gkcli cmd/gkcli/*
FROM alpine:3.20.0
RUN addgroup -S app \
&& adduser -S -g app app \
&& apk --no-cache add \
curl openssl netcat-openbsd
WORKDIR /home/app
COPY --from=builder /gk/bin/gk .
COPY --from=builder /gk/bin/gkcli /usr/local/bin/gkcli
RUN chown -R app:app ./
USER app
CMD ./gk --listen-host 0.0.0.0:10001 --log-level $LOG_LEVEL