diff --git a/Dockerfile b/Dockerfile index 3b4e0e6..ad222db 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,23 +1,20 @@ FROM python:3.8-slim -WORKDIR /app -COPY Pipfile Pipfile.lock /app/ - -RUN set -xe \ - 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 - -RUN set -xe \ - 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/* \ - && useradd _gunicorn --no-create-home --user-group +RUN apt-get update -q \ + && apt-get install -y -q \ + gcc \ + libssl-dev \ + curl \ + postgresql-client \ + gunicorn3 +RUN useradd _gunicorn --no-create-home --user-group COPY . /app/ WORKDIR /app + +RUN chmod +x "/app/docker_run.sh" \ + && pip install pipenv \ + && pipenv install --dev --deploy --system --ignore-pipfile + +ENTRYPOINT ["/app/docker_run.sh"] + diff --git a/Pipfile b/Pipfile index 7c6ba87..21da729 100644 --- a/Pipfile +++ b/Pipfile @@ -26,12 +26,12 @@ marshmallow-enum = "*" marshmallow-sqlalchemy = "*" sentry-sdk = {extras = ["flask"],version = "==0.14.4"} swagger-ui-bundle = "*" -spiffworkflow = {git = "https://github.com/sartography/SpiffWorkflow.git",ref = "master"} webtest = "*" python-box = "*" psycopg2-binary = "*" google-cloud-firestore = "*" globus-sdk = "*" +gunicorn = "*" [requires] python_version = "3.8" diff --git a/Pipfile.lock b/Pipfile.lock index 49260d7..1a007b4 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "088457a63c637e71582d594acf34d6fa3eccf097f07298c0cb1505b59d0f7783" + "sha256": "d21912b50ed403a1436f4eb9feed3facedea30b4c9e887620d7e8359e1cdba88" }, "pipfile-spec": 6, "requires": { @@ -385,6 +385,14 @@ ], "version": "==1.32.0" }, + "gunicorn": { + "hashes": [ + "sha256:1904bb2b8a43658807108d59c3f3d56c2b6121a701161de0ddf9ad140073c626", + "sha256:cd4a810dd51bf497552cf3f863b575dabd73d6ad6a91075b65936b151cbf4f9c" + ], + "index": "pypi", + "version": "==20.0.4" + }, "idna": { "hashes": [ "sha256:b307872f855b18632ce0c21c5e45be78c0ea7ae4c15c828c20788b26921eb3f6", @@ -392,14 +400,6 @@ ], "version": "==2.10" }, - "importlib-metadata": { - "hashes": [ - "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83", - "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070" - ], - "markers": "python_version < '3.8'", - "version": "==1.7.0" - }, "inflection": { "hashes": [ "sha256:1a29730d366e996aaacffb2f1f1cb9593dc38e2ddd30c91250c6dde09ea9b417", @@ -731,10 +731,6 @@ ], "version": "==2.0.1" }, - "spiffworkflow": { - "git": "https://github.com/sartography/SpiffWorkflow.git", - "ref": "5b379f33d8eba9383ee26050b14a79c6f7a2a1ba" - }, "sqlalchemy": { "hashes": [ "sha256:072766c3bd09294d716b2d114d46ffc5ccf8ea0b714a4e1c48253014b771c6bb", @@ -822,13 +818,6 @@ "sha256:81195de0ac94fbc8368abbaf9197b88c4f3ffd6c2719b5bf5fc9da744f3d829c" ], "version": "==2.3.3" - }, - "zipp": { - "hashes": [ - "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b", - "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96" - ], - "version": "==3.1.0" } }, "develop": { @@ -879,14 +868,6 @@ "index": "pypi", "version": "==5.3" }, - "importlib-metadata": { - "hashes": [ - "sha256:90bb658cdbbf6d1735b6341ce708fc7024a3e14e99ffdc5783edea9f9b077f83", - "sha256:dc15b2969b4ce36305c51eebe62d418ac7791e9a157911d58bfb1f9ccd8e2070" - ], - "markers": "python_version < '3.8'", - "version": "==1.7.0" - }, "iniconfig": { "hashes": [ "sha256:80cf40c597eb564e86346103f609d74efce0f6b4d4f30ec8ce9e2c26411ba437", @@ -958,13 +939,6 @@ "sha256:bda89d5935c2eac546d648028b9901107a595863cb36bae0c73ac804a9b4ce88" ], "version": "==0.10.1" - }, - "zipp": { - "hashes": [ - "sha256:aa36550ff0c0b7ef7fa639055d797116ee891440eac1a56f378e2d3179e0320b", - "sha256:c599e4d75c98f6798c509911d08a22e6c021d074469042177c8c86fb92eefd96" - ], - "version": "==3.1.0" } } } diff --git a/docker_run.sh b/docker_run.sh index 14d272e..9de502f 100755 --- a/docker_run.sh +++ b/docker_run.sh @@ -19,6 +19,12 @@ if [ "$RESET_DB" = "true" ]; then fi # THIS MUST BE THE LAST COMMAND! +if [ -z "$PORT0" ] +then + echo "$PORT0 is not set, setting to 5000" + PORT0=5000 +fi + if [ "$APPLICATION_ROOT" = "/" ]; then pipenv run gunicorn --bind 0.0.0.0:$PORT0 wsgi:app else