Skip to content

Commit

Permalink
Upgrade base images and introduce alpine 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
GaretJax committed Aug 14, 2018
1 parent 2953ade commit 4924a54
Show file tree
Hide file tree
Showing 14 changed files with 171 additions and 32 deletions.
28 changes: 0 additions & 28 deletions CHANGELOG.rst

This file was deleted.

9 changes: 9 additions & 0 deletions py2.7-slim-stretch/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Changelog
=========

4.2 (2018-08-14)
----------------

* Introduce a CHANGELOG.
* Upgrade to Python 2.7.15.
* Upgrade system to latest available packages.
2 changes: 1 addition & 1 deletion py2.7-slim-stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:2.7.14-slim-stretch AS build
FROM python:2.7.15-slim-stretch AS build

ARG TARGET=prod

Expand Down
3 changes: 3 additions & 0 deletions py2.7-slim-stretch/stack/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ mkdir -p /usr/share/man/man7/
# Update package listings
apt-get update

# Update system
apt-get upgrade

#
# SYSTEM PACKAGES
#
Expand Down
9 changes: 9 additions & 0 deletions py3.6-alpine3.6/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Changelog
=========

4.7 (2018-08-14)
----------------

* Introduce a CHANGELOG.
* Upgrade to Python 3.6.6.
* Add the mailcap package to provide mimetypes.
3 changes: 2 additions & 1 deletion py3.6-alpine3.6/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6.4-alpine3.6 AS build
FROM python:3.6.6-alpine3.6 AS build

ARG TARGET=prod
ENV PATH=/root/.local/bin:$PATH
Expand All @@ -22,6 +22,7 @@ RUN apk add \
libwebp \
libxml2 \
libxslt \
mailcap \
openjpeg \
pcre \
postgresql-client \
Expand Down
9 changes: 9 additions & 0 deletions py3.6-alpine3.7/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Changelog
=========

1.1 (2018-08-14)
----------------

* Introduce a CHANGELOG.
* Upgrade to Python 3.6.6.
* Add the mailcap package to provide mimetypes.
3 changes: 2 additions & 1 deletion py3.6-alpine3.7/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6.4-alpine3.7 AS build
FROM python:3.6.6-alpine3.7 AS build

ARG TARGET=prod
ENV PATH=/root/.local/bin:$PATH
Expand All @@ -22,6 +22,7 @@ RUN apk add \
libwebp \
libxml2 \
libxslt \
mailcap \
openjpeg \
pcre \
postgresql-client \
Expand Down
7 changes: 7 additions & 0 deletions py3.6-alpine3.8/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Changelog
=========

1.0 (2018-08-14)
----------------

* Initial release of Python 3.6 / Alpine 3.8 base image.
99 changes: 99 additions & 0 deletions py3.6-alpine3.8/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
FROM python:3.6.6-alpine3.8 AS build

ARG TARGET=prod
ENV PATH=/root/.local/bin:$PATH

# Add edge packages
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories
RUN echo @edge http://nl.alpinelinux.org/alpine/edge/community >> /etc/apk/repositories
RUN apk update && apk upgrade

# Dependencies
RUN apk add \
curl \
freetype \
gdal@edge \
gettext \
jpeg \
lcms2 \
libffi \
libressl2.7-libtls \
libwebp \
libxml2 \
libxslt \
mailcap \
openjpeg \
pcre \
postgresql-client \
postgresql-libs \
proj4@edge \
tiff \
tini \
yaml

RUN if [ "$TARGET" = "dev" ] ; then apk add \
freetype-dev \
g++ \
gcc \
gdal-dev@edge \
gfortran \
ghostscript-dev \
imagemagick-dev \
jpeg-dev \
lapack-dev \
lcms2-dev \
libffi-dev \
libressl-dev \
libwebp-dev \
libxml2-dev \
libxslt-dev \
linux-headers \
make \
musl-dev \
openjpeg-dev \
pcre-dev \
postgresql-dev \
proj4-dev@edge \
readline-dev \
tiff-dev \
yaml-dev \
zlib-dev \
; fi

# Python environment setup
RUN curl https://raw.githubusercontent.com/mitsuhiko/pipsi/master/get-pipsi.py | python
RUN /root/.local/venvs/pipsi/bin/pip install virtualenv
RUN ln -s /root/.local/venvs/pipsi/bin/virtualenv /root/.local/bin/virtualenv

RUN pipsi install pip-reqs==0.5
# `start` has no requirements, install through pip instead of pipsi to save
# some space by avoiding to setup a full virtualenv.
RUN pip install start==0.2
RUN if [ "$TARGET" = "dev" ] ; then pipsi install 'https://github.com/aldryncore/pip-tools/archive/1.9.0.1.tar.gz#egg=pip-tools==1.9.0.1' ; fi

COPY add_addons_dev_to_syspath.py /usr/local/lib/python3.6/site-packages/add_addons_dev_to_syspath.py
RUN echo 'import add_addons_dev_to_syspath' >/usr/local/lib/python3.6/site-packages/add_addons_dev_to_syspath.pth
# Workaround for stack size issues on musl-c, see the following URL for details:
# https://github.com/voidlinux/void-packages/issues/4147
RUN echo 'import threading; threading.stack_size(8 * 1024 ** 2)' >/usr/local/lib/python3.6/site-packages/set_threads_stack_size.pth

# Cleanup
RUN rm -rf /root/.cache

# Application environment setup
RUN mkdir -p /app


FROM scratch
COPY --from=build / /

# Execution environment setup
ENV WHEELS_PLATFORM=alpine37-py36 \
PROCFILE_PATH=/app/Procfile \
PATH=/root/.local/bin:$PATH \
NGINX_CONF_PATH=/dev/null
WORKDIR /app
EXPOSE 80/tcp 443/tcp
ENTRYPOINT ["/sbin/tini", "--"]
CMD ["start", "web"]
17 changes: 17 additions & 0 deletions py3.6-alpine3.8/add_addons_dev_to_syspath.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
"""
Adds all directories in /app/addons-dev to sys.path.
"""
import os
import sys


base_path = os.environ.get('ADDONS_DEV_PATH', '/app/addons-dev')

if os.path.exists(base_path):
all_directories_in_base_path = next(os.walk(base_path))[1]
for pkg in sorted(all_directories_in_base_path, reverse=True):
# sorted in reverse so they end up in alphabetical order
# (insert(0) reverses the order)
pkg_dir = os.path.join(base_path, pkg)
if pkg_dir not in sys.path:
sys.path.insert(0, pkg_dir)
9 changes: 9 additions & 0 deletions py3.6-slim-stretch/CHANGELOG.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Changelog
=========

4.9 (2018-08-14)
----------------

* Introduce a CHANGELOG.
* Upgrade to Python 3.6.6.
* Upgrade system to latest available packages.
2 changes: 1 addition & 1 deletion py3.6-slim-stretch/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM python:3.6.4-slim-stretch AS build
FROM python:3.6.6-slim-stretch AS build

ARG TARGET=prod

Expand Down
3 changes: 3 additions & 0 deletions py3.6-slim-stretch/stack/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ mkdir -p /usr/share/man/man7/
# Update package listings
apt-get update

# Update system
apt-get upgrade

#
# SYSTEM PACKAGES
#
Expand Down

0 comments on commit 4924a54

Please sign in to comment.