Tightened up how the Docker containers are created.

master
Pacman Ghost 4 years ago
parent d07118591f
commit 689e6122ac
  1. 7
      .dockerignore
  2. 32
      Dockerfile

@ -0,0 +1,7 @@
*
! setup.py
! requirements*.txt
! vasl_templates/
! docker/
! LICENSE.txt

@ -1,27 +1,39 @@
# NOTE: Use the run-container.sh script to build and launch this container.
FROM python:alpine3.6
# We do a multi-stage build (requires Docker >= 17.05) to install everything, then copy it all
# to the final target image.
FROM python:alpine3.6 AS base
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FROM base AS build
# install the requirements
# NOTE: pillow needs zlib and jpeg, lxml needs libxslt, we need build-base for gcc, etc.
RUN apk add --no-cache build-base zlib-dev jpeg-dev libxslt-dev
ENV LIBRARY_PATH=/lib:/usr/lib
WORKDIR /app
# install the application requirements
COPY requirements.txt requirements-dev.txt ./
RUN pip install -r requirements.txt
ARG ENABLE_TESTS
RUN if [ "$ENABLE_TESTS" ]; then pip install -r requirements-dev.txt ; fi
# install the Python requirements
COPY requirements.txt requirements-dev.txt ./
RUN pip install -r requirements.txt ; \
if [ "$ENABLE_TESTS" ]; then pip install -r requirements-dev.txt ; fi
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
FROM base
COPY --from=build /usr/local/lib/python3.6/site-packages /usr/local/lib/python3.6/site-packages
RUN apk add --no-cache libjpeg
# install the application
ADD vasl_templates vasl_templates
COPY setup.py LICENSE.txt ./
WORKDIR /app
COPY vasl_templates vasl_templates
COPY setup.py requirements.txt requirements-dev.txt LICENSE.txt ./
RUN pip install -e .
# copy the config files
COPY docker/config/* vasl_templates/webapp/config/
ARG ENABLE_TESTS
RUN if [ "$ENABLE_TESTS" ]; then echo "ENABLE_REMOTE_TEST_CONTROL = 1" >>vasl_templates/webapp/config/debug.cfg ; fi
EXPOSE 5010

Loading…
Cancel
Save