Compare commits

...

2 commits

5 changed files with 41 additions and 0 deletions

1
.dockerignore Normal file
View file

@ -0,0 +1 @@
.git

7
Dockerfile Normal file
View file

@ -0,0 +1,7 @@
FROM alpine:3.13
RUN apk add --no-cache \
openssh-server \
rsync
RUN mkdir -p /root/.ssh && cp /etc/ssh/sshd_config /etc/default_sshd_config

7
Makefile Normal file
View file

@ -0,0 +1,7 @@
.PHONY: build
build:
docker build -t registry.0xdad.com/rsync-ssh-server:latest .
.PHONY: deploy
deploy: build
docker push registry.0xdad.com/rsync-ssh-server:latest

View file

@ -1,2 +1,11 @@
# docker-rsync-server
This is a simple docker image definition for starting an SSH server that is used for rsyncing to volume mounts.
## Volumes
| path | description |
|----------------------------|---------------------------------------|
| /root/.ssh/authorized_keys | the ssh keys to allow for auth |
| /etc/ssh | location for SSH host keys and config |
| anywhere else | the locations available for rsync |

17
entrypoint.sh Normal file
View file

@ -0,0 +1,17 @@
#!/bin/sh
set -eu
ssh-keygen -A
if [ ! -e '/etc/ssh/sshd_config' ]; then
cp /etc/default_sshd_config /etc/ssh/sshd_config
fi
/usr/sbin/sshd
while pgrep -f /usr/sbin/sshd; do
sleep 5
done
>&2 echo 'SSHD is no longer running'
exit 1