diff --git a/Dockerfile b/Dockerfile index 26f7323..f572b5a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,16 +1,19 @@ -FROM python:3-slim +# syntax=docker/dockerfile:latest +FROM scratch AS files -WORKDIR / +# Copy ssh-audit code to temporary container +COPY ssh-audit.py / +COPY src/ / + +FROM python:3-alpine AS runtime # Update the image to remediate any vulnerabilities. -RUN apt update && apt -y upgrade && apt -y dist-upgrade && rm -rf /var/lib/apt/lists/* +RUN apk upgrade -U --no-cache -a -l && \ + # Remove suid & sgid bits from all files. + find / -xdev -perm /6000 -exec chmod ug-s {} \; 2> /dev/null || true -# Remove suid & sgid bits from all files. -RUN find / -xdev -perm /6000 -exec chmod ug-s {} \; 2> /dev/null || true - -# Copy the ssh-audit code. -COPY ssh-audit.py . -COPY src/ . +# Copy the ssh-audit code from files container. +COPY --from=files / / # Allow listening on 2222/tcp for client auditing. EXPOSE 2222