Skip to content

Commit

Permalink
Allow to specify custom user and group using environment variables.
Browse files Browse the repository at this point in the history
* SYNCTHING_USER
* SYNCTHING_USER_UID
* SYNCTHING_GROUP
* SYNCTHING_GROUP_GID

Issue #3
  • Loading branch information
bigbrozer committed Jul 7, 2019
1 parent edff540 commit 7557ebc
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ LABEL license="MIT"
LABEL description="Docker image for syncthing installation. \
Think for RaspberryPi."

# User definition environment variables
ENV SYNCTHING_USER syncthing
ENV SYNCTHING_USER_UID 500
ENV SYNCTHING_GROUP syncthing
ENV SYNCTHING_GROUP_GID 500

# gpg: key 00654A3E: public key "Syncthing Release Management <release@syncthing.net>" imported
ENV SYNCTHING_GPG_KEY 37C84554E7E0A261E4F76E1ED26E6ED000654A3E

Expand All @@ -31,20 +37,20 @@ RUN set -x \
&& rmdir "$dir" \
&& apk del .temp-deps;

RUN addgroup -S -g 500 syncthing && \
adduser -S -u 500 -D -G syncthing syncthing;
RUN addgroup -S -g ${SYNCTHING_GROUP_UID} ${SYNCTHING_GROUP} && \
adduser -S -u ${SYNCTHING_USER_UID} -D -G ${SYNCTHING_GROUP} ${SYNCTHING_USER};

RUN mkdir -p /etc/syncthing /syncedfolders

COPY ./config.xml /etc/syncthing

RUN chown -R syncthing:syncthing /etc/syncthing
RUN chown -R ${SYNCTHING_USER}:${SYNCTHING_GROUP} /etc/syncthing

VOLUME ["/etc/syncthing"]

EXPOSE 8384 22000 21027/udp

USER syncthing
USER ${SYNCTHING_USER}

ENTRYPOINT ["/usr/local/bin/syncthing"]

Expand Down

0 comments on commit 7557ebc

Please sign in to comment.