Skip to content

Commit 31e2169

Browse files
committed
Optimize python build time #562
1 parent 7714f55 commit 31e2169

6 files changed

+45
-44
lines changed

Diff for: utils/build/docker/python/django-poc.Dockerfile

+1-18
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,9 @@
1-
FROM python:3.9
2-
3-
# print versions
4-
RUN python --version && curl --version
5-
6-
# install hello world app
7-
RUN pip install django pycryptodome gunicorn gevent requests
8-
9-
RUN mkdir app
10-
RUN django-admin startproject django_app app
11-
WORKDIR /app
12-
RUN python3 manage.py startapp app
13-
14-
RUN sed -i "1s/^/from django.urls import include\n/" django_app/urls.py
15-
RUN sed -i "s/admin\///g" django_app/urls.py
16-
RUN sed -i "s/admin.site.urls/include(\"app.urls\")/g" django_app/urls.py
17-
RUN sed -i "s/ALLOWED_HOSTS\s=\s\[\]/ALLOWED_HOSTS = \[\"0.0.0.0\",\"weblog\"\,\"localhost\"\]/g" django_app/settings.py
1+
FROM datadog/system-tests:django-poc.base-v0
182

193
COPY utils/build/docker/python/django/app.sh /app/app.sh
204
COPY utils/build/docker/python/django/django.app.urls.py /app/app/urls.py
215
COPY utils/build/docker/python/iast.py /app/iast.py
226

23-
247
COPY utils/build/docker/python/install_ddtrace.sh utils/build/docker/python/get_appsec_rules_version.py binaries* /binaries/
258
RUN /binaries/install_ddtrace.sh
269

Diff for: utils/build/docker/python/django-poc.base.Dockerfile

+25
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
FROM python:3.9-slim
2+
3+
# install bin dependancies
4+
RUN apt-get update && apt-get install -y curl git gcc g++
5+
6+
# print versions
7+
RUN python --version && curl --version
8+
9+
# install python deps
10+
RUN pip install django pycryptodome gunicorn gevent requests
11+
12+
RUN mkdir app
13+
RUN django-admin startproject django_app app
14+
WORKDIR /app
15+
RUN python3 manage.py startapp app
16+
17+
RUN sed -i "1s/^/from django.urls import include\n/" django_app/urls.py
18+
RUN sed -i "s/admin\///g" django_app/urls.py
19+
RUN sed -i "s/admin.site.urls/include(\"app.urls\")/g" django_app/urls.py
20+
RUN sed -i "s/ALLOWED_HOSTS\s=\s\[\]/ALLOWED_HOSTS = \[\"0.0.0.0\",\"weblog\"\,\"localhost\"\]/g" django_app/settings.py
21+
22+
23+
# docker build --progress=plain -f utils/build/docker/python/django-poc.base.Dockerfile -t datadog/system-tests:django-poc.base-v0 .
24+
# docker push datadog/system-tests:django-poc.base-v0
25+

Diff for: utils/build/docker/python/flask-poc.Dockerfile

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
FROM python:3.9
2-
3-
# print versions
4-
RUN python --version && curl --version
5-
6-
# install hello world app
7-
# Tracer does not support flask 2.3.0 or higher, pin the flask version for now
8-
RUN pip install flask==2.2.4 gunicorn gevent requests pycryptodome psycopg2
1+
FROM datadog/system-tests:flask-poc.base-v0
92

103
COPY utils/build/docker/python/flask /app
114
COPY utils/build/docker/python/iast.py /app/iast.py
@@ -23,6 +16,5 @@ ENV DD_REMOTECONFIG_POLL_SECONDS=1
2316
ENV FLASK_APP=app.py
2417
CMD ./app.sh
2518

26-
# docker build -f utils/build/docker/python.flask-poc.Dockerfile -t test .
19+
# docker build -f utils/build/docker/python/flask-poc.Dockerfile -t test .
2720
# docker run -ti -p 7777:7777 test
28-

Diff for: utils/build/docker/python/flask-poc.base.Dockerfile

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
FROM python:3.9-slim
2+
3+
# install bin dependancies
4+
RUN apt-get update && apt-get install -y curl git gcc g++
5+
6+
# print versions
7+
RUN python --version && curl --version
8+
9+
# install python deps
10+
# Tracer does not support flask 2.3.0 or higher, pin the flask version for now
11+
RUN pip install flask==2.2.4 gunicorn gevent requests pycryptodome psycopg2-binary
12+
13+
# docker build --progress=plain -f utils/build/docker/python/flask-poc.base.Dockerfile -t datadog/system-tests:flask-poc.base-v0 .
14+
# docker push datadog/system-tests:flask-poc.base-v0
15+

Diff for: utils/build/docker/python/uds-flask.Dockerfile

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
FROM python:3.9
2-
3-
# print versions
4-
RUN python --version && curl --version
5-
6-
# install hello world app
7-
# Tracer does not support flask 2.3.0 or higher, pin the flask version for now
8-
RUN pip install flask==2.2.4 gunicorn gevent requests pycryptodome psycopg2
1+
FROM datadog/system-tests:flask-poc.base-v0
92

103
COPY utils/build/docker/python/flask /app
114
COPY utils/build/docker/python/iast.py /app/iast.py

Diff for: utils/build/docker/python/uwsgi-poc.Dockerfile

+1-8
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,4 @@
1-
FROM python:3.9
2-
3-
# print versions
4-
RUN python --version && curl --version
5-
6-
# install hello world app
7-
# Tracer does not support flask 2.3.0 or higher, pin the flask version for now
8-
RUN pip install flask==2.2.4 uwsgi requests pycryptodome psycopg2
1+
FROM datadog/system-tests:flask-poc.base-v0
92

103
COPY utils/build/docker/python/flask /app
114
COPY utils/build/docker/python/iast.py /app/iast.py

0 commit comments

Comments
 (0)