-
Notifications
You must be signed in to change notification settings - Fork 6
/
Dockerfile
40 lines (30 loc) · 873 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
39
40
FROM golang:1.21.6-alpine3.19 as builder
ARG COMMIT
ARG VERSION
WORKDIR /go/src/lfgw/
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ENV CGO_ENABLED=0 \
GOOS=linux
RUN go install \
-installsuffix "static" \
-ldflags " \
-X main.commit=${COMMIT} \
-X main.version=${VERSION} \
-X main.goVersion=$(go version | cut -d " " -f 3) \
" \
./...
FROM alpine:3.19.1 as runtime
RUN set -x \
&& apk add --update --no-cache ca-certificates tzdata \
&& echo 'Etc/UTC' > /etc/timezone \
&& update-ca-certificates
ENV TZ=/etc/localtime \
LANG=en_US.utf8 \
LC_ALL=en_US.UTF-8
COPY --from=builder /go/bin/lfgw /
RUN chmod +x /lfgw
RUN adduser -S appuser -u 1000 -G root
USER 1000
ENTRYPOINT ["/lfgw"]