-
Notifications
You must be signed in to change notification settings - Fork 554
Expand file tree
/
Copy pathDockerfile
More file actions
40 lines (27 loc) · 1.01 KB
/
Dockerfile
File metadata and controls
40 lines (27 loc) · 1.01 KB
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
# syntax=docker/dockerfile:1.7
ARG GO_VERSION=1.26.2
ARG ALPINE_VERSION=3.22
FROM golang:${GO_VERSION}-alpine AS build
RUN apk add --no-cache ca-certificates git tzdata
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
ARG VERSION=dev
ARG COMMIT=unknown
ARG DATE=unknown
RUN CGO_ENABLED=0 GOOS=linux go build -trimpath \
-ldflags="-s -w -X github.com/steipete/gogcli/internal/cmd.version=${VERSION} -X github.com/steipete/gogcli/internal/cmd.commit=${COMMIT} -X github.com/steipete/gogcli/internal/cmd.date=${DATE}" \
-o /out/gog ./cmd/gog
FROM alpine:${ALPINE_VERSION}
LABEL org.opencontainers.image.source="https://github.com/steipete/gogcli"
LABEL org.opencontainers.image.description="Google services CLI for terminal automation"
LABEL org.opencontainers.image.licenses="MIT"
RUN apk add --no-cache ca-certificates tzdata \
&& adduser -D -u 10001 -h /home/gog gog
ENV HOME=/home/gog
WORKDIR /home/gog
COPY --from=build /out/gog /usr/local/bin/gog
USER gog
ENTRYPOINT ["gog"]
CMD ["--help"]