Dockerfile 1.19 KB
Newer Older
1 2
# ==================================== BASE ====================================
ARG INSTALL_PYTHON_VERSION=${INSTALL_PYTHON_VERSION:-3.7}
David Mendez's avatar
David Mendez committed
3 4
ARG CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX=${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX:-'gitlab.ebi.ac.uk/chembl/dependency_proxy/containers'}
FROM ${CI_DEPENDENCY_PROXY_GROUP_IMAGE_PREFIX}/python:${INSTALL_PYTHON_VERSION}-slim-buster AS base
5
ENV CONFIG_FILE_PATH=${CONFIG_FILE_PATH:-'/etc/run_config/RUN_CONFIG.yml'}
6
ENV GUNICORN_CONFIG_FILE_PATH=${GUNICORN_CONFIG_FILE_PATH:-'/etc/gunicorn_config/GUNICORN_CONFIG.py'}
7 8 9

RUN apt-get update
RUN apt-get install -y \
10 11 12
    curl \
    netcat \
    iputils-ping \
13 14
    ssh \
    build-essential \
David Mendez's avatar
David Mendez committed
15
    libpq-dev
16

David Mendez's avatar
David Mendez committed
17 18
WORKDIR /app
COPY requirements.txt .
19 20

RUN useradd -m glados -u 2892
David Mendez's avatar
David Mendez committed
21
RUN chown -R glados:glados /app
22 23
USER glados
ENV PATH="/home/glados/.local/bin:${PATH}"
David Mendez's avatar
David Mendez committed
24 25 26 27

RUN pip install --user -r requirements.txt
COPY . .

28
FROM base AS development-server
David Mendez's avatar
David Mendez committed
29
ENTRYPOINT FLASK_APP=app flask run --host=0.0.0.0
30

31
FROM base AS production-server
32 33
# Take into account that the app will get the configuration from the variable DELAYED_JOBS_RAW_CONFIG if the config.yml
# file is not found.
34
ENTRYPOINT gunicorn wsgi:FLASK_APP -c ${GUNICORN_CONFIG_FILE_PATH}