You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

47 lines
1.4 KiB

  1. FROM alpine:3.20
  2. MAINTAINER Valentin Lab <valentin.lab@kalysto.org>
  3. ## coreutils is for ``date`` support of ``--rfc-3339=seconds`` argument.
  4. ## findutils is for ``find`` support of ``--newermt`` argument.
  5. ## gawk is for ``awk`` support of unicode strings.
  6. ## btrfs-progs is for ``btrfs`` support for snapshotting capacity
  7. RUN apk add rsync sudo bash openssh-server coreutils findutils gawk btrfs-progs
  8. RUN ssh-keygen -A
  9. ## New user/group rsync/rsync with home dir in /var/lib/rsync
  10. RUN mkdir -p /var/lib/rsync /var/log/rsync && \
  11. addgroup -S rsync && \
  12. adduser -S rsync -h /var/lib/rsync -G rsync && \
  13. chown rsync:rsync /var/lib/rsync /var/log/rsync
  14. ## Without this, account is considered locked by SSH
  15. RUN sed -ri 's/^rsync:!:/rsync:*NP*:/g' /etc/shadow
  16. ## Withouth this, force-command will not run
  17. RUN sed -ri 's%^(rsync.*:)[^:]+$%\1/bin/bash%g' /etc/passwd
  18. ## Allow rsync to access /var/mirror
  19. COPY /src /
  20. RUN chmod 440 /etc/sudoers.d/*
  21. RUN mkdir /var/run/sshd
  22. ENV SCRIPT_LOGCHUNK_SHA="0.1.0"
  23. RUN apk add curl; export pkg ; \
  24. for pkg in logchunk; do \
  25. echo "Getting $pkg..." ; \
  26. bash -c -- 'varname=${pkg^^} ; varname=${varname//-/_} ; \
  27. eval curl https://docker.0k.io/downloads/$pkg-\${SCRIPT_${varname^^}_SHA}' > \
  28. /usr/local/bin/"$pkg" || exit 1 ; \
  29. chmod +x /usr/local/bin/"$pkg" ; \
  30. done
  31. COPY ./entrypoint.sh /entrypoint.sh
  32. EXPOSE 22
  33. ENTRYPOINT [ "/entrypoint.sh" ]