mirror of
https://github.com/sartography/cr-connect-workflow.git
synced 2025-02-22 12:48:25 +00:00
Refactors Dockerfile again. Installs gunicorn. Don't run gunicorn until the container starts up.
This commit is contained in:
parent
5ec97dc68d
commit
b1718078ff
63
Dockerfile
63
Dockerfile
@ -1,48 +1,31 @@
|
||||
#
|
||||
# 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
|
||||
FROM python:3.7-slim
|
||||
|
||||
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 .
|
||||
COPY Pipfile Pipfile.lock /app/
|
||||
|
||||
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
|
||||
&& pip install pipenv
|
||||
&& apt-get update -q \
|
||||
&& apt-get install -y -q \
|
||||
gcc python3-dev libssl-dev \
|
||||
curl postgresql-client git-core \
|
||||
gunicorn3 postgresql-client \
|
||||
&& pipenv install --dev \
|
||||
&& apt-get remove -y gcc python3-dev libssl-dev \
|
||||
&& apt-get autoremove -y \
|
||||
&& apt-get clean -y \
|
||||
&& rm -rf /var/lib/apt/lists/* \
|
||||
&& mkdir -p /app \
|
||||
&& useradd _gunicorn --no-create-home --user-group
|
||||
|
||||
COPY . /app/
|
||||
USER _gunicorn
|
||||
|
||||
COPY ./crc/static /app/static
|
||||
COPY ./docker_run.sh /app/
|
||||
COPY ./wait-for-it.sh /app/
|
||||
WORKDIR /app
|
||||
ENV FLASK_APP=/app/crc/__init__.py
|
||||
|
||||
CMD ["gunicorn3", \
|
||||
"--bind", "0.0.0.0:8000", \
|
||||
"crc:app"]
|
||||
# Don't run gunicorn until the DC/OS container actually starts.
|
||||
# Otherwise, environment variables will not be availabele.
|
||||
#CMD ["pipenv", "run", "gunicorn", \
|
||||
# "--bind", "0.0.0.0:8000", \
|
||||
# "-e", "SCRIPT_NAME=/api", \
|
||||
# "crc:app"]
|
||||
|
1
Pipfile
1
Pipfile
@ -36,6 +36,7 @@ python-dateutil = "*"
|
||||
pandas = "*"
|
||||
xlrd = "*"
|
||||
ldap3 = "*"
|
||||
gunicorn = "*"
|
||||
|
||||
[requires]
|
||||
python_version = "3.7"
|
||||
|
10
Pipfile.lock
generated
10
Pipfile.lock
generated
@ -1,7 +1,7 @@
|
||||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "a632f1a0b0f66dbddb4e0a43837b8e168ad78b8c4c5a8e6eba25a0145fe14477"
|
||||
"sha256": "5363eb56e2e1622e2c443647fdf0b1963f3d0ee7b25c61f7065a542e546ece5b"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
@ -307,6 +307,14 @@
|
||||
],
|
||||
"version": "==0.18.2"
|
||||
},
|
||||
"gunicorn": {
|
||||
"hashes": [
|
||||
"sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626",
|
||||
"sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==20.0.4"
|
||||
},
|
||||
"httpretty": {
|
||||
"hashes": [
|
||||
"sha256:24a6fd2fe1c76e94801b74db8f52c0fb42718dc4a199a861b305b1a492b9d868"
|
||||
|
Loading…
x
Reference in New Issue
Block a user