mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 20:58:28 +00:00
46 lines
1.1 KiB
Docker
46 lines
1.1 KiB
Docker
#
|
|
# 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
|
|
|
|
ADD . /app
|
|
WORKDIR /app
|
|
|
|
RUN pipenv install --dev \
|
|
&& pipenv lock -r > requirements.txt \
|
|
&& pipenv run python setup.py bdist_wheel
|
|
|
|
# ----------------------------------------------------------------------------
|
|
FROM ubuntu:bionic
|
|
|
|
ARG DEBIAN_FRONTEND=noninteractive
|
|
|
|
COPY --from=pipenv /app/dist/*.whl .
|
|
|
|
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 *.whl \
|
|
&& 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
|
|
ADD static /app/static
|
|
WORKDIR /app
|
|
|
|
CMD ["gunicorn3", \
|
|
"--bind", "0.0.0.0:8000", \
|
|
"crc:app"]
|