Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
48 lines (35 loc) · 1.62 KB
/
Copy pathDockerfile
File metadata and controls
48 lines (35 loc) · 1.62 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
41
42
43
44
45
46
47
48
# syntax=docker/dockerfile:1.27.0
ARG GO_VERSION=1.27.4
ARG ALPINE_VERSION=3.24
FROM golang:${GO_VERSION}-alpine@sha256:0a5f7fe796599ff487605987432e7619ae45beeb2fba4c2ce0b907879932aebf AS build
RUN apk add --no-cache --upgrade ca-certificates=20261020-r0 ca-certificates-bundle=20261020-r0
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/openclaw/gogcli/internal/cmd.version=${VERSION} -X github.com/openclaw/gogcli/internal/cmd.commit=${COMMIT} -X github.com/openclaw/gogcli/internal/cmd.date=${DATE}" \
-o /out/gog ./cmd/gog
FROM alpine:${ALPINE_VERSION}
RUN apk add --no-cache --upgrade ca-certificates=20261020-r0 ca-certificates-bundle=20261020-r0
LABEL org.opencontainers.image.source="https://github.com/openclaw/gogcli"
LABEL org.opencontainers.image.description="Google services CLI for terminal automation"
LABEL org.opencontainers.image.licenses="MIT"
# /persist/gogcli is the documented persistent GOG_HOME (docs/install.md). A
# fresh named volume mounted there is seeded from the image, ownership
# included, so pre-creating it owned by gog keeps the non-root runtime able to
# initialise its state directories on first run (#1197).
RUN apk add --no-cache ca-certificates tzdata \
&& adduser -D -u 10001 -h /home/gog gog \
&& mkdir -p /persist/gogcli \
&& chown gog:gog /persist/gogcli
ENV HOME=/home/gog
WORKDIR /home/gog
COPY --from=build /out/gog /usr/local/bin/gog
USER gog
ENTRYPOINT ["gog"]
CMD ["--help"]