Skip to content

Commit 0eb90c4

Browse files
committed
fix: Dockerfile for library-only module with no cmd/ directory
tok has no main package or cmd/ directory. Change to build verification only (go build ./...) and add tzdata for zoneinfo.
1 parent 371757d commit 0eb90c4

1 file changed

Lines changed: 11 additions & 6 deletions

File tree

Dockerfile

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,21 @@
11
FROM golang:1.26.3-alpine AS builder
22

3+
RUN apk add --no-cache tzdata
4+
35
WORKDIR /src
46
COPY go.mod go.sum ./
57
RUN go mod download
68

79
COPY . .
8-
ARG VERSION=dev
9-
RUN CGO_ENABLED=0 go build -trimpath -ldflags="-s -w -X 'github.com/GrayCodeAI/tok/internal/version.Version=${VERSION}'" -o /tok ./cmd/tok/
10+
RUN CGO_ENABLED=0 go build -trimpath ./...
1011

1112
FROM alpine:3.21
12-
RUN apk add --no-cache ca-certificates git
13-
COPY --from=builder /tok /usr/local/bin/tok
13+
RUN apk add --no-cache ca-certificates git tini && \
14+
adduser -D -u 1000 tok
15+
16+
COPY --from=builder /usr/share/zoneinfo /usr/share/zoneinfo
1417

15-
ENTRYPOINT ["tok"]
16-
CMD ["--help"]
18+
USER tok
19+
WORKDIR /workspace
20+
ENTRYPOINT ["tini", "--"]
21+
CMD ["sleep", "infinity"]

0 commit comments

Comments
 (0)