build(docker): Non-root docker image (#155)

This commit is contained in:
Shiipou 2023-05-23 17:58:44 +02:00 committed by GitHub
parent e8c84ae4f3
commit 20f7523393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,7 +17,17 @@ LABEL maintainer="Boshi Lian<farmer1992@gmail.com>"
COPY --from=ep76/openssh-static:latest /usr/bin/ssh-keygen /bin/ssh-keygen
RUN mkdir /etc/ssh/
COPY --from=builder /sshpiperd/ /sshpiperd
# Add user nobody with id 1
ARG USERID=1000
ARG GROUPID=1000
RUN addgroup -g $GROUPID -S sshpiperd && adduser -u $USERID -S sshpiperd -G sshpiperd
# Add execution rwx to user 1
RUN chown -R $USERID:$GROUPID /etc/ssh/
USER $USERID:$GROUPID
COPY --from=builder --chown=$USERID /sshpiperd/ /sshpiperd
EXPOSE 2222
CMD ["/sshpiperd/entrypoint.sh"]