Skip to content

Commit

Permalink
use alpine, reduce layers (#249)
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Thamdrup <[email protected]>
  • Loading branch information
dallemon authored Mar 13, 2024
1 parent cb0f6b6 commit 6f39407
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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/ /

# Update the image to remediate any vulnerabilities.
RUN apt update && apt -y upgrade && apt -y dist-upgrade && rm -rf /var/lib/apt/lists/*
FROM python:3-alpine AS runtime

# Remove suid & sgid bits from all files.
RUN find / -xdev -perm /6000 -exec chmod ug-s {} \; 2> /dev/null || true
# Update the image to remediate any vulnerabilities.
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

# 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
Expand Down

0 comments on commit 6f39407

Please sign in to comment.