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.
This commit is contained in:
Trung Dong Huynh 2020-01-07 11:06:31 +00:00
parent 49edb56ab9
commit b22045bcd4
11 changed files with 38 additions and 30 deletions

View File

@ -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

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o nounset

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o nounset

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o nounset

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o pipefail

View File

@ -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

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o pipefail

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o nounset

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o pipefail

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o pipefail

View File

@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/bash
set -o errexit
set -o pipefail