This repository has been archived on 2023-11-19. You can view files and clone it, but cannot push or open issues or pull requests.
sshsi/Dockerfile

18 lines
680 B
Docker

FROM docker.io/alpine:latest
SHELL ["/bin/ash", "-o", "pipefail", "-c"]
RUN apk add --no-cache "openssh" "augeas" && \
deluser "$(getent passwd 33 | cut -d: -f1)" && \
delgroup "$(getent group 33 | cut -d: -f1)" 2>/dev/null || true && \
mkdir -p '~root/.ssh' '/etc/authorized_keys' && chmod 700 '~root/.ssh/' && \
augtool 'set /files/etc/ssh/sshd_config/AuthorizedKeysFile ".ssh/authorized_keys /etc/authorized_keys/%u"' && \
echo -e "Port 22\n" >> '/etc/ssh/sshd_config' && \
cp -a '/etc/ssh' '/etc/ssh.cache'
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D", "-e", "-f", "/etc/ssh/sshd_config"]
COPY entrypoint.sh /entrypoint.sh
ENTRYPOINT [ "/entrypoint.sh" ]