Skip to content

Commit 3b1d608

Browse files
docker: remove dev dependencies from release images
1 parent 24ff59e commit 3b1d608

File tree

5 files changed

+21
-11
lines changed

5 files changed

+21
-11
lines changed

Dockerfile.django-alpine

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ COPY requirements.txt ./
3131
# https://github.com/unbit/uwsgi/issues/1318#issuecomment-542238096
3232
RUN CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
3333

34-
FROM base AS django
34+
FROM base AS release
3535
WORKDIR /app
3636
ARG uid=1001
3737
ARG gid=1337
@@ -136,5 +136,11 @@ ENV \
136136
DD_UWSGI_NUM_OF_THREADS="2"
137137
ENTRYPOINT ["/entrypoint-uwsgi.sh"]
138138

139-
FROM django AS django-unittests
139+
FROM release AS development
140+
USER root
141+
COPY requirements-dev.txt ./
142+
RUN pip3 install --no-cache-dir -r requirements-dev.txt
143+
USER ${uid}
144+
145+
FROM development AS django-unittests
140146
COPY unittests/ ./unittests/

Dockerfile.django-debian

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ COPY requirements.txt ./
3030
# https://github.com/unbit/uwsgi/issues/1318#issuecomment-542238096
3131
RUN CPUCOUNT=1 pip3 wheel --wheel-dir=/tmp/wheels -r ./requirements.txt
3232

33-
FROM base AS django
33+
FROM base AS release
3434
WORKDIR /app
3535
ARG uid=1001
3636
ARG gid=1337
@@ -139,5 +139,11 @@ ENV \
139139
DD_UWSGI_NUM_OF_THREADS="2"
140140
ENTRYPOINT ["/entrypoint-uwsgi.sh"]
141141

142-
FROM django AS django-unittests
142+
FROM release AS development
143+
USER root
144+
COPY requirements-dev.txt ./
145+
RUN pip3 install --no-cache-dir -r requirements-dev.txt
146+
USER ${uid}
147+
148+
FROM development AS django-unittests
143149
COPY unittests/ ./unittests/

docker-compose.override.dev.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
services:
33
uwsgi:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile.django-debian
7+
target: development
48
entrypoint: ['/wait-for-it.sh', '${DD_DATABASE_HOST:-postgres}:${DD_DATABASE_PORT:-5432}', '-t', '30', '--', '/entrypoint-uwsgi-dev.sh']
59
volumes:
610
- '.:/app:z'

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ services:
3434
build:
3535
context: ./
3636
dockerfile: "Dockerfile.django-${DEFECT_DOJO_OS:-debian}"
37-
target: django
37+
target: release
3838
image: "defectdojo/defectdojo-django:${DJANGO_VERSION:-latest}"
3939
depends_on:
4040
initializer:

requirements.txt

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,16 +51,11 @@ packageurl-python==0.17.5
5151
django-crum==0.7.9
5252
JSON-log-formatter==1.1.1
5353
django-split-settings==1.3.2
54-
django-debug-toolbar==5.2.0
55-
django-debug-toolbar-request-history==0.1.4
56-
vcrpy==7.0.0
57-
vcrpy-unittest==0.1.7
5854
django-tagulous==2.1.1
5955
PyJWT==2.10.1
6056
cvss==3.6
6157
django-fieldsignals==0.7.0
6258
hyperlink==21.0.0
63-
django-test-migrations==1.4.0
6459
djangosaml2==1.11.1
6560
drf-spectacular==0.28.0
6661
drf-spectacular-sidecar==2025.8.1
@@ -75,4 +70,3 @@ fontawesomefree==6.6.0
7570
PyYAML==6.0.2
7671
pyopenssl==25.1.0
7772
parameterized==0.9.0
78-
watchdog==6.0.0 # only needed for development, but would require some docker refactoring if we want to exclude it for production images

0 commit comments

Comments
 (0)