Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactoring of the Dockerfile #654

Merged
merged 1 commit into from
Dec 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
**/__pycache__
/tests
/docs
/.github
/.github
/.git
26 changes: 17 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
FROM python:3.9-slim
# set python version
ARG PYTHON_VERSION="3.12"

FROM docker.io/python:${PYTHON_VERSION}-slim AS build
COPY . /sslyze/
# install latest updates as root
RUN apt-get update \
&& apt-get install -y sudo
WORKDIR /sslyze
# use a venv
RUN python -m venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
# install sslyze based on sourcecode
RUN python -m pip install --upgrade pip setuptools wheel
RUN python /sslyze/setup.py install
RUN pip install --upgrade pip setuptools wheel
RUN pip install .

FROM docker.io/python:${PYTHON_VERSION}-slim AS run
# set user to a non-root user sslyze
RUN adduser --no-create-home --disabled-password --gecos "" --uid 1001 sslyze
USER sslyze
# restrict execution to sslyze
WORKDIR /sslyze
ENTRYPOINT ["python", "-m", "sslyze"]
CMD ["-h"]
# copy sslyze from build stage
COPY --from=build /opt/venv /opt/venv
ENV PATH="/opt/venv/bin:$PATH"
ENTRYPOINT ["sslyze"]
CMD ["-h"]
Loading