Commit ccec86d5 authored by Johan Bloemberg's avatar Johan Bloemberg Committed by Johan Bloemberg

Switch to alpine to reduce release image size.

parent acaf782a
Pipeline #17436597 passed with stages
in 5 minutes and 31 seconds
......@@ -2,3 +2,4 @@
.*
# don't invalidate cache when Dockerfile changes
Dockerfile
*.sqlite3
......@@ -131,7 +131,7 @@ build:
- python3 setup.py --version > version
# build docker image and push to registry
- docker build -t registry.gitlab.com/failmap/failmap:build .
- docker build . --tag registry.gitlab.com/failmap/failmap:build
- docker push registry.gitlab.com/failmap/failmap:build
# push version tag to docker registry
......@@ -160,7 +160,7 @@ build_test:
script:
# build docker image to test building
- docker build . -t failmap
- docker build . --tag failmap
# run simple smoketests to verify Docker image is sane
- tests/docker.sh docker
......
# use full image for build (compile) dependencies
FROM python:3.6 as build
# base build on small footprint image
FROM python:3.6-alpine as build
RUN apk --no-cache add \
build-base \
zlib-dev \
jpeg-dev \
libffi-dev \
openssl-dev \
mariadb-dev \
postgresql-dev \
linux-headers
# install app and dependencies in a artifact-able directory
RUN pip install virtualenv
......@@ -20,17 +30,19 @@ COPY setup.py setup.cfg MANIFEST.in requirements.dev.txt version* /source/
# but allows the source to be overwritten by a volume during development.
RUN /pyenv/bin/pip install -e /source/ --no-deps
# switch to lightweight base image for distribution
FROM python:3.6-slim
# hack for slim image to fix broken install of postgres
RUN /bin/bash -c 'mkdir -p /usr/share/man/man{1..8}'
# install dependent libraries (remove cache to prevent inclusion in layer)
RUN apt-get update && \
apt-get install -yqq libxml2 libmysqlclient18 mysql-client postgresql \
postgresql-contrib mime-support python-watchdog python-setuptools && \
rm -rf /var/lib/apt/lists/*
# restart with a clean image
FROM python:3.6-alpine
# mailcap includes mimetypes required by uwsgi
RUN apk --no-cache add \
zlib\
libjpeg \
libffi \
openssl \
libxml2 \
mariadb-client-libs \
postgresql-libs \
mailcap
# install build application
COPY --from=build /pyenv /pyenv
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment