Skip to content

Commit 1dc3c5e

Browse files
committed
Change: Update Dockerfile to build without required wheel
Update building the notus-scanner container image to not require a pre-build wheel distributable and instead build the distributable within the Dockerfile.
1 parent 6c14726 commit 1dc3c5e

File tree

3 files changed

+25
-9
lines changed

3 files changed

+25
-9
lines changed

.docker/prod.Dockerfile

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ COPY smoketest /usr/local/src
55
WORKDIR /usr/local/src
66
RUN make build-cmds
77

8+
FROM debian:stable-slim as builder
9+
10+
COPY . /source
11+
12+
WORKDIR /source
13+
14+
RUN apt-get update && \
15+
apt-get install --no-install-recommends --no-install-suggests -y \
16+
python3 \
17+
python-is-python3 \
18+
python3-pip && \
19+
apt-get remove --purge --auto-remove -y && \
20+
rm -rf /var/lib/apt/lists/*
21+
22+
RUN python -m pip install --upgrade pip && \
23+
python3 -m pip install poetry
24+
25+
RUN rm -rf dist && poetry build -f wheel
26+
827
FROM greenbone/openvas-scanner:${VERSION}
928

1029
ENV PYTHONDONTWRITEBYTECODE 1
@@ -39,7 +58,7 @@ RUN mkdir -p /run/ospd && \
3958
chmod 644 /etc/openvas/openvas_log.conf && \
4059
chmod 755 /usr/local/bin/entrypoint
4160

42-
COPY dist/* /ospd-openvas
61+
COPY --from=builder /source/dist/* /ospd-openvas/
4362

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

.dockerignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
.venv
2+
.github
3+
.git
4+
.vscode
5+
dist

.github/workflows/container.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,6 @@ jobs:
3737
with:
3838
username: ${{ secrets.DOCKERHUB_USERNAME }}
3939
password: ${{ secrets.DOCKERHUB_TOKEN }}
40-
- name: Set up Python
41-
uses: actions/setup-python@v4
42-
with:
43-
python-version: 3.9
44-
- name: Install poetry
45-
uses: greenbone/actions/poetry@v1
46-
- name: Build wheel
47-
run: poetry build -f wheel
4840
- name: Set up QEMU
4941
uses: docker/setup-qemu-action@v2
5042
- name: Set up Docker Buildx

0 commit comments

Comments
 (0)