53 lines
1.3 KiB
Docker
53 lines
1.3 KiB
Docker
FROM golang:1.20.6-bookworm as builder
|
|
|
|
ARG TARGETARCH
|
|
ARG TARGETOS
|
|
|
|
ENV VERSION 498fcaa7c3413a2d9d0aaf67cfe5fdeec76bff71
|
|
|
|
RUN apt update -y && \
|
|
mkdir /perkeep && \
|
|
cd /perkeep && \
|
|
git init && \
|
|
git remote add origin https://github.com/perkeep/perkeep.git && \
|
|
git fetch origin $VERSION && \
|
|
git reset --hard FETCH_HEAD
|
|
|
|
WORKDIR /perkeep
|
|
|
|
RUN go run make.go --arch $TARGETARCH --os $TARGETOS
|
|
|
|
FROM alpine:3.18.2
|
|
|
|
ENV USER perkeep
|
|
ENV GROUP perkeep
|
|
ENV UID 1000
|
|
ENV GID 1001
|
|
|
|
RUN addgroup -S $GROUP --gid $GID && \
|
|
adduser \
|
|
--disabled-password \
|
|
--gecos "" \
|
|
--home "/$USER" \
|
|
--shell "/bin/sh" \
|
|
--ingroup "$GROUP" \
|
|
--uid "$UID" \
|
|
"$USER" && \
|
|
apk add --no-cache libc6-compat envsubst
|
|
|
|
USER $USER
|
|
|
|
RUN mkdir /perkeep/data && \
|
|
mkdir /perkeep/config
|
|
|
|
COPY --chown=$USER:$GROUP --chmod=750 --from=builder /go/bin/* /usr/local/bin/
|
|
COPY --chown=$USER:$GROUP --chmod=750 server-config.tpl.json /perkeep/server-config-custom.tpl.json
|
|
COPY --chown=$USER:$GROUP --chmod=750 docker-entrypoint.sh /docker-entrypoint.sh
|
|
|
|
VOLUME /perkeep/data
|
|
VOLUME /perkeep/config
|
|
|
|
EXPOSE 3179
|
|
|
|
# /docker-entrypoint.sh perkeepd -configfile /perkeep/config/server-config-custom.json
|
|
ENTRYPOINT ["/docker-entrypoint.sh", "perkeepd", "-configfile", "/perkeep/config/server-config-custom.json"] |