diff --git a/Dockerfile b/Dockerfile index 192e95f..d27622f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,15 +2,12 @@ FROM alpine:latest RUN apk add git apache2 openssh cgit py3-markdown py3-pygments -COPY sshd_config /etc/ssh/sshd_config +COPY sshd_config /sshd_config COPY httpd.conf /etc/apache2/httpd.conf COPY cgitrc /etc/cgitrc COPY entrypoint.sh /entrypoint.sh COPY update-mirrors.sh /update-mirrors.sh -# Generate host keys for the server -RUN ssh-keygen -A - # Create directory for cgit config RUN mkdir -p /etc/cgit.d diff --git a/entrypoint.sh b/entrypoint.sh index e76383a..9cef573 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -2,6 +2,16 @@ set -m +# Create host keys if they haven't been created already +if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then + ssh-keygen -A +fi + +# Copy the SSH config if it hasn't already been setup +if [ ! -f /etc/ssh/sshd_config ]; then + cp /sshd_config /etc/ssh/sshd_config +fi + /usr/sbin/sshd -De & /usr/sbin/crond -fd8 &