1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
FROM golang:1.27-alpine AS build
WORKDIR /src
COPY go.mod go.sum ./
RUN go mod download
COPY . .
RUN CGO_ENABLED=0 go build -trimpath -ldflags='-s -w' -o /gitpocket .
FROM alpine:3.22
ARG UID=65532 GID=65532
RUN apk add --no-cache git gnupg openssh-keygen ca-certificates && \
(getent group "$GID" || addgroup -g "$GID" git) && \
adduser -D -H -h /srv/gitpocket -s /sbin/nologin -u "$UID" -G "$(getent group "$GID" | cut -d: -f1)" git
COPY --from=build /gitpocket /usr/local/bin/gitpocket
ENV HOME=/tmp GOMEMLIMIT=192MiB
USER $UID:$GID
EXPOSE 3200
ENTRYPOINT ["/usr/local/bin/gitpocket", "-root", "/srv/gitpocket"]
CMD ["serve", "-listen", ":3200"]
|