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 # syncthing
FROM alpine:3.14 FROM alpine:3.15
ARG ARCH ARG TARGETPLATFORM
ENV VER v1.18.3 ENV VERSION v1.20.1
ENV REL syncthing-linux-${ARCH}-${VER}
ENV URI https://github.com/syncthing/syncthing/releases/download/${VER}/${REL}.tar.gz
RUN apk add --no-cache su-exec RUN addgroup --gid 10001 syncthing && \
adduser \
RUN adduser -u 1001 -h /var/lib/syncthing -D syncthing && \ --uid 10000 \
addgroup -S -g 1005 books && addgroup syncthing books && \ --home /var/lib/syncthing \
addgroup -S -g 1006 buku && addgroup syncthing buku --ingroup syncthing \
--disabled-password \
RUN mkdir -p /data && chown -R syncthing:syncthing /data --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 VOLUME /data /var/lib/syncthing
USER 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"]
CMD ["/usr/local/bin/syncthing", "-home=/var/lib/syncthing"] CMD ["/usr/local/bin/syncthing", "-home=/var/lib/syncthing"]

View File

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