Skip to content

Commit

Permalink
Change: Update Dockerfile to build without required wheel
Browse files Browse the repository at this point in the history
Update building the notus-scanner container image to not require a
pre-build wheel distributable and instead build the distributable within
the Dockerfile.

(cherry picked from commit 1dc3c5e)
  • Loading branch information
bjoernricks authored and mergify[bot] committed Aug 22, 2022
1 parent 2babe03 commit ce4ebf0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 9 deletions.
21 changes: 20 additions & 1 deletion .docker/prod.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
ARG VERSION=stable

FROM debian:stable-slim as builder

COPY . /source

WORKDIR /source

RUN apt-get update && \
apt-get install --no-install-recommends --no-install-suggests -y \
python3 \
python-is-python3 \
python3-pip && \
apt-get remove --purge --auto-remove -y && \
rm -rf /var/lib/apt/lists/*

RUN python -m pip install --upgrade pip && \
python3 -m pip install poetry

RUN rm -rf dist && poetry build -f wheel

FROM greenbone/openvas-scanner:${VERSION}

ENV PYTHONDONTWRITEBYTECODE 1
Expand Down Expand Up @@ -34,7 +53,7 @@ RUN mkdir -p /run/ospd && \
chmod 644 /etc/openvas/openvas_log.conf && \
chmod 755 /usr/local/bin/entrypoint

COPY dist/* /ospd-openvas
COPY --from=builder /source/dist/* /ospd-openvas/

RUN python3 -m pip install /ospd-openvas/*

Expand Down
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.venv
.github
.git
.vscode
dist
8 changes: 0 additions & 8 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,6 @@ jobs:
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Install poetry
uses: greenbone/actions/poetry@v1
- name: Build wheel
run: poetry build -f wheel
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down

0 comments on commit ce4ebf0

Please sign in to comment.