cr-connect-workflow/Dockerfile

49 lines
1.1 KiB
Docker
Raw Normal View History

2020-05-24 12:37:11 -04:00
#
# https://medium.com/@greut/building-a-python-package-a-docker-image-using-pipenv-233d8793b6cc
# https://github.com/greut/pipenv-to-wheel
#
FROM kennethreitz/pipenv as pipenv
2020-05-24 12:37:11 -04:00
ADD . /app
WORKDIR /app
2020-05-24 12:37:11 -04:00
RUN pipenv install --dev \
&& pipenv lock -r > requirements.txt \
&& pipenv run python setup.py bdist_wheel
2020-05-24 12:37:11 -04:00
# ----------------------------------------------------------------------------
FROM ubuntu:bionic
2020-05-24 12:37:11 -04:00
ARG DEBIAN_FRONTEND=noninteractive
2020-05-24 12:37:11 -04:00
COPY --from=pipenv /app/dist/*.whl .
2020-05-24 12:37:11 -04:00
RUN set -xe \
&& apt-get update -q \
&& apt-get install -y -q \
python3-minimal \
python3-wheel \
python3-pip \
gunicorn3 \
postgresql-client \
&& python3 -m pip install --target=/app *.whl \
2020-05-24 12:37:11 -04:00
&& apt-get remove -y python3-pip python3-wheel \
&& apt-get autoremove -y \
&& apt-get clean -y \
&& rm -f *.whl \
&& rm -rf /root/.cache \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /app \
&& useradd _gunicorn --no-create-home --user-group
USER _gunicorn
COPY crc/static /app/static
COPY docker_run.sh /app
COPY wait-for-it.sh /app
2020-05-24 12:37:11 -04:00
WORKDIR /app
CMD ["gunicorn3", \
"--bind", "0.0.0.0:8000", \
"crc:app"]