docker-borgserver/Dockerfile
Pietro 0108fcf653
Split run.sh and add git retrival
This patch modularize run.sh, adding two new helper scripts and
make it possible to specify a git repository for ssh keys via a
new env variable `BORG_SSHKEYS_REPO`.

the modularization add two new files :
- `env.sh` : define a few envriroment variables
- `create-client-dirs.sh`  : update and create user directories and
  re-create authorized_keys

We also add a new script `update-ssh-keys.sh` to be called regurlarly
in a cron job to check if the git repository is up-to-date and
eventually adding/removing users.
2020-03-24 14:03:24 +01:00

35 lines
991 B
Docker

############################################################
# Dockerfile to build borgbackup server images
# Based on Debian
############################################################
FROM debian:buster-slim
# Volume for SSH-Keys
VOLUME /sshkeys
# Volume for borg repositories
VOLUME /backup
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && apt-get -y --no-install-recommends install \
borgbackup openssh-server git ca-certificates && apt-get clean && \
useradd -s /bin/bash -m -U borg && \
mkdir /home/borg/.ssh && \
chmod 700 /home/borg/.ssh && \
chown borg:borg /home/borg/.ssh && \
mkdir /run/sshd && \
rm -f /etc/ssh/ssh_host*key* && \
rm -rf /var/lib/apt/lists/* /var/tmp/* /tmp/*
COPY ./data/run.sh /run.sh
COPY ./data/sshd_config /etc/ssh/sshd_config
COPY ./data/update-ssh-keys.sh /usr/local/bin/
COPY ./data/create-client-dirs.sh /usr/local/bin/
COPY ./data/env.sh /usr/local/bin/env.sh
ENTRYPOINT /run.sh
# Default SSH-Port for clients
EXPOSE 22