Repository navigation
Expand file tree
/
Copy pathDockerfile
More file actions
50 lines (38 loc) · 1.45 KB
/
Copy pathDockerfile
File metadata and controls
50 lines (38 loc) · 1.45 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
49
50
# syntax=docker/dockerfile:1.7
FROM golang:1.26-alpine AS build
ARG VERSION=dev
ARG COMMIT=unknown
WORKDIR /src
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/go/pkg/mod \
go mod download
COPY . .
RUN --mount=type=cache,target=/go/pkg/mod \
--mount=type=cache,target=/root/.cache/go-build \
CGO_ENABLED=0 GOOS=linux go build -trimpath \
-ldflags="-s -w -buildid=" \
-o /out/tracker ./cmd/tracker && \
CGO_ENABLED=0 GOOS=linux go build -trimpath \
-ldflags="-s -w -buildid=" \
-o /out/hqctl ./cmd/hqctl && \
CGO_ENABLED=0 GOOS=linux go build -trimpath \
-ldflags="-s -w -buildid=" \
-o /out/source ./cmd/source
FROM alpine:3.23
ARG VERSION=dev
ARG COMMIT=unknown
RUN apk add --no-cache ca-certificates tzdata && \
addgroup -g 65532 -S saveweb && \
adduser -u 65532 -S -D -H -G saveweb saveweb
COPY --from=build /out/hqctl /out/source /out/tracker /usr/local/bin/
COPY docker-entrypoint.sh /usr/local/bin/docker-entrypoint.sh
RUN chmod 0755 /usr/local/bin/docker-entrypoint.sh
LABEL org.opencontainers.image.title="SavewebHQ" \
org.opencontainers.image.description="PostgreSQL job coordinator for Saveweb archive workers" \
org.opencontainers.image.source="https://github.com/saveweb/hq" \
org.opencontainers.image.version="${VERSION}" \
org.opencontainers.image.revision="${COMMIT}"
USER 65532:65532
EXPOSE 8080
ENTRYPOINT ["/usr/local/bin/docker-entrypoint.sh"]
CMD ["serve"]