FROM archlinux
LABEL maintiner="Mark <mark@betalupi.com>"

# Create users and groups.
# Make sure uids and gids are the same on the host!
#
# Syncthing should be installed AFTER users are created.
# The package will create its own syncthing user if one does not exist.
# We need to do it manually, to control uid and gid.

RUN groupadd -g 1000 syncthing && \
	useradd -g 1000 -u 1000 syncthing -d /stdata && \
	pacman -Fyy --noconfirm && \
	pacman -Syu --noconfirm && \
	pacman -S --noconfirm syncthing syncthing-relaysrv

VOLUME /syncthing

# Syncthing
EXPOSE 8384

# Relay
EXPOSE 22067

COPY start.sh /start.sh
ENTRYPOINT ["/bin/bash", "start.sh"]