From 985358f55177f4aea871c7335c0e65d8f0aaa4a9 Mon Sep 17 00:00:00 2001 From: Sam Weston Date: Sat, 20 Aug 2022 11:33:19 +0100 Subject: [PATCH] Work around https://github.com/pypa/pipenv/issues/4453 --- Dockerfile | 24 +++++++++++------------- Pipfile.lock | 24 ++++++++++++------------ 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/Dockerfile b/Dockerfile index 91a26ff..5de1437 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,20 @@ # Set up a base build container and use to install pip dependencies FROM python:3.10-slim-bullseye as base FROM base as builder - -RUN pip install --user pipenv - -# Tell pipenv to create venv in the current directory -ENV PIPENV_VENV_IN_PROJECT=1 -ADD Pipfile.lock Pipfile /usr/src/ -WORKDIR /usr/src -RUN /root/.local/bin/pipenv sync +RUN pip install pipenv +RUN mkdir /install +WORKDIR /install +COPY Pipfile.lock /install/Pipfile.lock +RUN pipenv requirements >requirements.txt +RUN pip install --ignore-installed --prefix=/install --no-warn-script-location -r requirements.txt # Copy over pip dependencies from base FROM base -RUN mkdir -v /usr/src/.venv -COPY --from=builder /usr/src/.venv/ /usr/src/.venv/ +COPY --from=builder /install /usr/local -# Set up /usr/src as our runtime directory -WORKDIR /usr/src/ +# Set up /app as our runtime directory +RUN mkdir /app +WORKDIR /app # Run as non-root user RUN useradd -M gunicorn @@ -27,4 +25,4 @@ COPY ./ . # Run gunicorn as a production-suitable app server EXPOSE 7777 -CMD ./.venv/bin/python -m gunicorn --workers 4 --bind 0.0.0.0:7777 challenge.wsgi --keep-alive 5 --log-level info --access-logfile - +CMD gunicorn --workers 4 --bind 0.0.0.0:7777 challenge.wsgi --keep-alive 5 --log-level info --access-logfile - diff --git a/Pipfile.lock b/Pipfile.lock index eebfccc..7b147a9 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -34,19 +34,19 @@ }, "boto3": { "hashes": [ - "sha256:0f1689e487ea093be8a124cd5e9766cfcf2c153fc2af295c3853c5b63e2a73ed", - "sha256:ca8352b4af67cf15a8f399f71dfc31c6a0e5a7725afcf299c50aaaaa9f1e6782" + "sha256:09fb94008bd1f2566ef79ec7d8dd7a233b5da67f3b2536e30432eb8e88022d4d", + "sha256:9fab8acec76008797be4671d514f39f1163ba044c0a0bce8d5afe8b52cbd5550" ], "index": "pypi", - "version": "==1.24.51" + "version": "==1.24.56" }, "botocore": { "hashes": [ - "sha256:328d2baca30e66016acdf9ad3c5e6fa6522fca249f54c5affce8774c0faa564f", - "sha256:4ba1678bc78fbdac9a7e1c010b057ad9ed96dc6534d1c82718af08d746b652ed" + "sha256:81101abab2013992a84019739d85a6fa8ec6f1f42fb09ad07e0bf4c8f0efce60", + "sha256:81df81b1a1c5608b3a7aca6a837acb27552c3ecc92584a58b171c60754b1d4eb" ], "markers": "python_version >= '3.7'", - "version": "==1.27.51" + "version": "==1.27.56" }, "certifi": { "hashes": [ @@ -127,11 +127,11 @@ }, "charset-normalizer": { "hashes": [ - "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5", - "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413" + "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845", + "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f" ], "markers": "python_version >= '3.6'", - "version": "==2.1.0" + "version": "==2.1.1" }, "cryptography": { "hashes": [ @@ -415,11 +415,11 @@ }, "setuptools": { "hashes": [ - "sha256:194b74f2c2d1800268fe2d857d99981e7c04d010de3099f04ee45ebec535e560", - "sha256:3bcaf6e27ad3b0f643ba0a48c5ab9eca930c3eb51df0e068f4826ab880c394ea" + "sha256:10602cd0a6f5feab6656e9587f9075292ab777c5200f3bf00293ecd23d9f2788", + "sha256:d2e010624c781b26ad6629a8de9832327cf853dea93894487979e55f9ad06857" ], "markers": "python_version >= '3.7'", - "version": "==64.0.3" + "version": "==65.1.0" }, "six": { "hashes": [