updated syncthing image

main
Ricard Illa 2022-05-25 11:34:36 +02:00
parent 22da4e153e
commit 7898e07eaf
No known key found for this signature in database
GPG Key ID: F69A672B72E54902
3 changed files with 38 additions and 41 deletions

View File

@ -1,30 +1,29 @@
# syncthing
FROM alpine:3.14
FROM alpine:3.15
ARG ARCH
ENV VER v1.18.3
ENV REL syncthing-linux-${ARCH}-${VER}
ENV URI https://github.com/syncthing/syncthing/releases/download/${VER}/${REL}.tar.gz
ARG TARGETPLATFORM
ENV VERSION v1.20.1
RUN apk add --no-cache su-exec
RUN adduser -u 1001 -h /var/lib/syncthing -D syncthing && \
addgroup -S -g 1005 books && addgroup syncthing books && \
addgroup -S -g 1006 buku && addgroup syncthing buku
RUN mkdir -p /data && chown -R syncthing:syncthing /data
RUN addgroup --gid 10001 syncthing && \
adduser \
--uid 10000 \
--home /var/lib/syncthing \
--ingroup syncthing \
--disabled-password \
--shell /sbin/nologin \
syncthing && \
mkdir -p /data && chown -R syncthing:syncthing /data && \
cd /tmp && \
ARCH=$(echo "$TARGETPLATFORM" | sed 's/\//-/') && \
RELEASE="syncthing-${ARCH}-${VERSION}" && \
URI="https://github.com/syncthing/syncthing/releases/download/${VERSION}/${RELEASE}.tar.gz" && \
echo "$URI" && \
wget "${URI}" && \
tar -xzf "${RELEASE}.tar.gz" && \
cp "/tmp/${RELEASE}/syncthing" /usr/local/bin/syncthing && \
rm -r "/tmp/${RELEASE}" "/tmp/${RELEASE}.tar.gz"
VOLUME /data /var/lib/syncthing
RUN cd /tmp && \
wget ${URI} && \
tar -xzf ${REL}.tar.gz && \
cp /tmp/${REL}/syncthing /usr/local/bin/syncthing && \
rm -r /tmp/${REL} /tmp/${REL}.tar.gz
COPY docker-entrypoint.sh /entrypoint
RUN chmod +x /entrypoint
ENTRYPOINT ["/entrypoint"]
USER syncthing
CMD ["/usr/local/bin/syncthing", "-home=/var/lib/syncthing"]

View File

@ -1,24 +1,31 @@
IMG_NAME = syncthing
REGISTRY=registry.monotremata.xyz:443
REGISTRY=registry.monotremata.xyz
IMG=$(REGISTRY)/$(IMG_NAME)
PLATFORMS=linux/amd64,linux/arm64
.PHONY: build build-nc push
.PHONY: build build-nc buildx push
hw=$(shell uname -m)
ifeq ($(hw), x86_64)
ARCH=amd64
TARGETPLATFORM=linux/amd64
else ifeq ($(hw), aarch64)
ARCH=arm64
TARGETPLATFORM=linux/arm64
else
ARCH=$(hw)
TARGETPLATFORM=linux/$(hw)
endif
build: Dockerfile docker-entrypoint.sh
docker build -t $(IMG) --build-arg ARCH=$(ARCH) .
build: Dockerfile
docker build -t $(IMG) --build-arg TARGETPLATFORM=$(TARGETPLATFORM) .
buildx: Dockerfile
docker buildx build \
--platform $(PLATFORMS) \
--tag $(IMG) \
--push \
.
push: build
docker image push $(IMG)
build-nc: Dockerfile docker-entrypoint.sh
build-nc: Dockerfile
docker build --no-cache -t $(IMG) --build-arg ARCH=$(ARCH) .

View File

@ -1,9 +0,0 @@
#!/bin/sh
chown -R syncthing:syncthing /data
chown -R syncthing:syncthing /var/lib/syncthing
chown -R syncthing:books /data/books
chown -R syncthing:buku /data/buku && touch /data/buku/bookmarks.db && chmod '664' /data/buku/bookmarks.db
chmod '2775' /data/books
exec su-exec syncthing "$@"