31 lines
743 B

  1. FROM alpine:3.9
  2. MAINTAINER Valentin Lab <valentin.lab@kalysto.org>
  3. RUN apk add rsync sudo bash openssh-server
  4. RUN ssh-keygen -A
  5. ## New user/group rsync/rsync with home dir in /var/lib/rsync
  6. RUN mkdir -p /var/lib/rsync && \
  7. addgroup -S rsync && \
  8. adduser -S rsync -h /var/lib/rsync -G rsync && \
  9. chown rsync:rsync /var/lib/rsync
  10. ## Without this, account is concidered locked by SSH
  11. RUN sed -ri 's/^rsync:!:/rsync:*NP*:/g' /etc/shadow
  12. ## Withouth this, force-command will not run
  13. RUN sed -ri 's%^(rsync.*:)[^:]+$%\1/bin/bash%g' /etc/passwd
  14. ## Allow rsync to access /var/mirror
  15. COPY /src /
  16. RUN chmod 440 /etc/sudoers.d/*
  17. RUN mkdir /var/run/sshd
  18. COPY ./entrypoint.sh /entrypoint.sh
  19. EXPOSE 22
  20. ENTRYPOINT [ "/entrypoint.sh" ]