feature: running image first version
This commit is contained in:
parent
7d48de6c9d
commit
920b017342
53
Dockerfile
Normal file
53
Dockerfile
Normal file
@ -0,0 +1,53 @@
|
||||
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 gpg
|
||||
|
||||
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.json /perkeep/config/server-config-custom.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"]
|
21
Makefile
Normal file
21
Makefile
Normal file
@ -0,0 +1,21 @@
|
||||
.PHONY: imagePerkeep
|
||||
|
||||
REGISTRY_NAME=docker.registry
|
||||
# linux/arm/v7
|
||||
# linux/arm/v6
|
||||
# linux/arm64
|
||||
# linux/amd64
|
||||
PLATFORM=linux/amd64,linux/arm64
|
||||
#VERBOSITY=info
|
||||
VERBOSITY=debug
|
||||
|
||||
## build
|
||||
|
||||
imagePerkeep:
|
||||
docker manifest rm $(REGISTRY_NAME):5000/perkeep:latest || true
|
||||
docker-multi-arch-builder build -n perkeep --platforms $(PLATFORM) -v $(VERBOSITY)
|
||||
|
||||
## management
|
||||
|
||||
status:
|
||||
@curl -s $(REGISTRY_NAME):5000/v2/_catalog | jq
|
12
docker-entrypoint.sh
Normal file
12
docker-entrypoint.sh
Normal file
@ -0,0 +1,12 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ ! -f /perkeep/config/identity-secring.gpg ];
|
||||
then
|
||||
pk put init -newkey
|
||||
mv perkeep/.config/perkeep/identity-secring.gpg /perkeep/config/
|
||||
IDENTITY=$(sed -n -e '/identity/ s/.*:.*"\(.*\)".*/\1/p' /perkeep/.config/perkeep/client-config.json | tee /dev/tty)
|
||||
sed -i -e "s/TO_REPLACE/$IDENTITY/g" /perkeep/config/server-config-custom.json
|
||||
rm -r /perkeep/.config
|
||||
fi
|
||||
|
||||
exec "$@"
|
11
server-config.json
Normal file
11
server-config.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"auth": "localhost",
|
||||
"listen": "0.0.0.0:3179",
|
||||
"camliNetIP": "",
|
||||
"identity": "TO_REPLACE",
|
||||
"identitySecretRing": "/perkeep/config/identity-secring.gpg",
|
||||
"blobPath": "/perkeep/data/blobs",
|
||||
"packRelated": true,
|
||||
"sqlite": "/perkeep/data/index.sqlite",
|
||||
"shareHandler": false
|
||||
}
|
Loading…
Reference in New Issue
Block a user