Skip to content

Commit a998455

Browse files
committed
feat(docker): Clean official image from (unit)tests
Signed-off-by: kiblik <[email protected]>
1 parent 4c5de62 commit a998455

File tree

4 files changed

+26
-15
lines changed

4 files changed

+26
-15
lines changed

.github/workflows/release-x-manual-docker-containers.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ jobs:
7676
push: true
7777
file: ./Dockerfile.${{ matrix.docker-image }}-${{ matrix.os }}
7878
context: .
79+
target: release
7980
outputs: type=image,"name=${{ env.DOCKER_ORG }}/defectdojo-${{ matrix.docker-image}}",push-by-digest=true,name-canonical=true
8081
cache-from: type=gha,scope=${{ matrix.docker-image}}-${{ matrix.os }}-${{ env.PLATFORM }}-${{ github.head_ref || github.ref_name }}
8182
cache-to: type=gha,mode=max,scope=${{ matrix.docker-image}}-${{ matrix.os }}-${{ env.PLATFORM }}-${{ github.head_ref || github.ref_name }}

Dockerfile.django-alpine

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,25 +68,20 @@ RUN \
6868
COPY \
6969
docker/entrypoint-celery-beat.sh \
7070
docker/entrypoint-celery-worker.sh \
71-
docker/entrypoint-celery-worker-dev.sh \
7271
docker/entrypoint-initializer.sh \
7372
docker/entrypoint-first-boot.sh \
7473
docker/entrypoint-uwsgi.sh \
75-
docker/entrypoint-uwsgi-dev.sh \
76-
docker/entrypoint-unit-tests.sh \
77-
docker/entrypoint-unit-tests-devDocker.sh \
7874
docker/wait-for-it.sh \
7975
docker/secret-file-loader.sh \
8076
docker/reach_database.sh \
8177
docker/certs/* \
8278
/
83-
COPY wsgi.py manage.py docker/unit-tests.sh ./
79+
COPY wsgi.py manage.py ./
8480
COPY dojo/ ./dojo/
8581

8682
# Add extra fixtures to docker image which are loaded by the initializer
8783
COPY docker/extra_fixtures/* /app/dojo/fixtures/
8884

89-
COPY tests/ ./tests/
9085
RUN \
9186
# Remove placeholder copied from docker/certs
9287
rm -f /readme.txt && \
@@ -139,9 +134,19 @@ ENTRYPOINT ["/entrypoint-uwsgi.sh"]
139134

140135
FROM release AS development
141136
USER root
142-
COPY requirements-dev.txt ./
137+
COPY \
138+
requirements-dev.txt \
139+
docker/unit-tests.sh \
140+
./
141+
COPY \
142+
docker/entrypoint-celery-worker-dev.sh \
143+
docker/entrypoint-uwsgi-dev.sh \
144+
docker/entrypoint-unit-tests.sh \
145+
docker/entrypoint-unit-tests-devDocker.sh \
146+
/
143147
RUN pip3 install --no-cache-dir -r requirements-dev.txt
144148
USER ${uid}
145149

146150
FROM development AS django-unittests
147151
COPY unittests/ ./unittests/
152+
COPY tests/ ./tests/

Dockerfile.django-debian

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -71,25 +71,20 @@ RUN \
7171
COPY \
7272
docker/entrypoint-celery-beat.sh \
7373
docker/entrypoint-celery-worker.sh \
74-
docker/entrypoint-celery-worker-dev.sh \
7574
docker/entrypoint-initializer.sh \
7675
docker/entrypoint-first-boot.sh \
7776
docker/entrypoint-uwsgi.sh \
78-
docker/entrypoint-uwsgi-dev.sh \
79-
docker/entrypoint-unit-tests.sh \
80-
docker/entrypoint-unit-tests-devDocker.sh \
8177
docker/wait-for-it.sh \
8278
docker/secret-file-loader.sh \
8379
docker/reach_database.sh \
8480
docker/certs/* \
8581
/
86-
COPY wsgi.py manage.py docker/unit-tests.sh ./
82+
COPY wsgi.py manage.py ./
8783
COPY dojo/ ./dojo/
8884

8985
# Add extra fixtures to docker image which are loaded by the initializer
9086
COPY docker/extra_fixtures/* /app/dojo/fixtures/
9187

92-
COPY tests/ ./tests/
9388
RUN \
9489
# Remove placeholder copied from docker/certs
9590
rm -f /readme.txt && \
@@ -142,9 +137,19 @@ ENTRYPOINT ["/entrypoint-uwsgi.sh"]
142137

143138
FROM release AS development
144139
USER root
145-
COPY requirements-dev.txt ./
140+
COPY \
141+
requirements-dev.txt \
142+
docker/unit-tests.sh \
143+
./
144+
COPY \
145+
docker/entrypoint-celery-worker-dev.sh \
146+
docker/entrypoint-uwsgi-dev.sh \
147+
docker/entrypoint-unit-tests.sh \
148+
docker/entrypoint-unit-tests-devDocker.sh \
149+
/
146150
RUN pip3 install --no-cache-dir -r requirements-dev.txt
147151
USER ${uid}
148152

149153
FROM development AS django-unittests
150154
COPY unittests/ ./unittests/
155+
COPY tests/ ./tests/

Dockerfile.nginx-alpine

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ COPY dojo/ ./dojo/
6363
# always collect static for debug toolbar as we can't make it dependant on env variables or build arguments without breaking docker layer caching
6464
RUN env DD_SECRET_KEY='.' DD_DJANGO_DEBUG_TOOLBAR_ENABLED=True python3 manage.py collectstatic --noinput --verbosity=2 && true
6565

66-
FROM nginx:1.29.3-alpine3.22@sha256:b3c656d55d7ad751196f21b7fd2e8d4da9cb430e32f646adcf92441b72f82b14
66+
FROM nginx:1.29.3-alpine3.22@sha256:b3c656d55d7ad751196f21b7fd2e8d4da9cb430e32f646adcf92441b72f82b14 AS release
6767
ARG uid=1001
6868
ARG appuser=defectdojo
6969
COPY --from=collectstatic /app/static/ /usr/share/nginx/html/static/

0 commit comments

Comments
 (0)