Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Work around pypa/pipenv#4453
Browse files Browse the repository at this point in the history
  • Loading branch information
samweston-tails committed Aug 20, 2022
1 parent 31fd110 commit 985358f
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 25 deletions.
24 changes: 11 additions & 13 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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 -
24 changes: 12 additions & 12 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 985358f

Please sign in to comment.