From 03772dec1b40bd0a970f58528c4b920b76f7cc9e Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 21 Nov 2016 14:49:39 -0800 Subject: [PATCH 1/4] Update flake8 from 3.2.0 to 3.2.1 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 1052e217..369520cb 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ cookiecutter==1.4.0 -flake8==3.2.0 # pyup: != 2.6.0 +flake8==3.2.1 # pyup: != 2.6.0 sh==1.11 binaryornot==0.4.0 From 0c203241669277411df4bccf9d4bc9708c77affb Mon Sep 17 00:00:00 2001 From: pyup-bot Date: Mon, 21 Nov 2016 14:49:40 -0800 Subject: [PATCH 2/4] Update flake8 from 3.2.0 to 3.2.1 --- {{cookiecutter.project_slug}}/requirements/test.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.project_slug}}/requirements/test.txt b/{{cookiecutter.project_slug}}/requirements/test.txt index 2dc42bd4..704a508c 100644 --- a/{{cookiecutter.project_slug}}/requirements/test.txt +++ b/{{cookiecutter.project_slug}}/requirements/test.txt @@ -8,7 +8,7 @@ psycopg2==2.6.2 {%- endif %} coverage==4.2 -flake8==3.2.0 # pyup: != 2.6.0 +flake8==3.2.1 # pyup: != 2.6.0 django-test-plus==1.0.16 factory_boy==2.7.0 From b22045bcd4ebf563ccdcf226fb389a6bb71e2654 Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 7 Jan 2020 11:06:31 +0000 Subject: [PATCH 3/4] Replaced base Docker image with debian:buster-slim (#2373) Using system Python 3 distribution (3.7.3) in order to allow the use of Debian packages for numpy, scipy, etc. without the need of building them or installing build dependencies. Changed `#!/bin/sh` in shell scripts to `#!/bin/bash` to make `set -o pipefail` work. --- .../compose/local/django/Dockerfile | 24 +++++++++-------- .../compose/local/django/celery/beat/start | 2 +- .../compose/local/django/celery/flower/start | 2 +- .../compose/local/django/celery/worker/start | 2 +- .../compose/local/django/start | 2 +- .../compose/production/django/Dockerfile | 26 ++++++++++++------- .../production/django/celery/beat/start | 2 +- .../production/django/celery/flower/start | 2 +- .../production/django/celery/worker/start | 2 +- .../compose/production/django/entrypoint | 2 +- .../compose/production/django/start | 2 +- 11 files changed, 38 insertions(+), 30 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index a98547bd..6747322a 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -1,19 +1,21 @@ -FROM python:3.7-alpine +FROM debian:buster-slim ENV PYTHONUNBUFFERED 1 -RUN apk update \ +RUN apt-get update \ + # dependencies for building Python packages + && apt-get install -y build-essential python3-dev python3-pip \ + # link the system python3 as just python for convenience + && ln -s `which python3` /usr/local/bin/python \ + # update pip et al + && pip3 install -U pip setuptools wheel \ # psycopg2 dependencies - && apk add --virtual build-deps gcc python3-dev musl-dev \ - && apk add postgresql-dev \ - # Pillow dependencies - && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \ - # CFFI dependencies - && apk add libffi-dev py-cffi \ + && apt-get install -y libpq-dev \ # Translations dependencies - && apk add gettext \ - # https://docs.djangoproject.com/en/dev/ref/django-admin/#dbshell - && apk add postgresql-client + && apt-get install -y gettext \ + # cleaning up unused files + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* # Requirements are installed here to ensure they will be cached. COPY ./requirements /requirements diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start index 389e2baf..c04a7365 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/beat/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start index be67050d..5bcaa816 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/flower/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start index 072c6ae6..acd6f157 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/celery/worker/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/local/django/start b/{{cookiecutter.project_slug}}/compose/local/django/start index 921604dc..f076ee51 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/start +++ b/{{cookiecutter.project_slug}}/compose/local/django/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index b0861d60..ddc46f7b 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -9,21 +9,27 @@ RUN npm run build # Python build stage {%- endif %} -FROM python:3.7-alpine +FROM debian:buster-slim ENV PYTHONUNBUFFERED 1 -RUN apk update \ +RUN apt-get update \ + # dependencies for building Python packages + && apt-get install -y build-essential python3-dev python3-pip \ + # link the system python3 as just python for convenience + && ln -s `which python3` /usr/local/bin/python \ + # update pip et al + && pip3 install -U pip setuptools wheel \ # psycopg2 dependencies - && apk add --virtual build-deps gcc python3-dev musl-dev \ - && apk add postgresql-dev \ - # Pillow dependencies - && apk add jpeg-dev zlib-dev freetype-dev lcms2-dev openjpeg-dev tiff-dev tk-dev tcl-dev \ - # CFFI dependencies - && apk add libffi-dev py-cffi + && apt-get install -y libpq-dev \ + # Translations dependencies + && apt-get install -y gettext \ + # cleaning up unused files + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false \ + && rm -rf /var/lib/apt/lists/* -RUN addgroup -S django \ - && adduser -S -G django django +RUN addgroup --system django \ + && adduser --system --ingroup django django # Requirements are installed here to ensure they will be cached. COPY ./requirements /requirements diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start index 0e793e38..20b93123 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/beat/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start index be67050d..5bcaa816 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/flower/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o nounset diff --git a/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start b/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start index 4e519c3f..38fb77f3 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/celery/worker/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint index 0a76b310..95ab8297 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/entrypoint +++ b/{{cookiecutter.project_slug}}/compose/production/django/entrypoint @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail diff --git a/{{cookiecutter.project_slug}}/compose/production/django/start b/{{cookiecutter.project_slug}}/compose/production/django/start index 0ad39dfa..709c1dd0 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/start +++ b/{{cookiecutter.project_slug}}/compose/production/django/start @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash set -o errexit set -o pipefail From 4a71b0b9360b2ecea9518b4531a30f25c5735fff Mon Sep 17 00:00:00 2001 From: Trung Dong Huynh Date: Tue, 7 Jan 2020 13:54:15 +0000 Subject: [PATCH 4/4] Using the python:3.7-slim-buster image for later Python version - 3.7.6 (instead of debian:buster-slim, shipped with Python 3.7.3) --- .../compose/local/django/Dockerfile | 8 ++------ .../compose/production/django/Dockerfile | 8 ++------ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile index 6747322a..94c79952 100644 --- a/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/local/django/Dockerfile @@ -1,14 +1,10 @@ -FROM debian:buster-slim +FROM python:3.7-slim-buster ENV PYTHONUNBUFFERED 1 RUN apt-get update \ # dependencies for building Python packages - && apt-get install -y build-essential python3-dev python3-pip \ - # link the system python3 as just python for convenience - && ln -s `which python3` /usr/local/bin/python \ - # update pip et al - && pip3 install -U pip setuptools wheel \ + && apt-get install -y build-essential \ # psycopg2 dependencies && apt-get install -y libpq-dev \ # Translations dependencies diff --git a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile index ddc46f7b..9d4dc5fc 100644 --- a/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile +++ b/{{cookiecutter.project_slug}}/compose/production/django/Dockerfile @@ -9,17 +9,13 @@ RUN npm run build # Python build stage {%- endif %} -FROM debian:buster-slim +FROM python:3.7-slim-buster ENV PYTHONUNBUFFERED 1 RUN apt-get update \ # dependencies for building Python packages - && apt-get install -y build-essential python3-dev python3-pip \ - # link the system python3 as just python for convenience - && ln -s `which python3` /usr/local/bin/python \ - # update pip et al - && pip3 install -U pip setuptools wheel \ + && apt-get install -y build-essential \ # psycopg2 dependencies && apt-get install -y libpq-dev \ # Translations dependencies