From 8a4957abaf645b8187f4ae8bc03c17ec9fcee4b7 Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 10 Nov 2024 19:05:41 -0500 Subject: [PATCH] update dockerfile for pipenv --- Dockerfile | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index ffd4ed3..3dffc3f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,11 +1,24 @@ -FROM python:3.10.14-slim +FROM python:3.12.5-slim -RUN mkdir /opt/redeyes +# Keeps Python from generating .pyc files in the container +ENV PYTHONDONTWRITEBYTECODE=1 +# Turns off buffering for easier container logging +ENV PYTHONUNBUFFERED=1 -COPY . /opt/redeyes -WORKDIR /opt/redeyes +# Install & use pipenv +COPY Pipfile Pipfile.lock ./ +RUN python -m pip install --upgrade pip +RUN pip install pipenv && pipenv install --dev --system --deploy -RUN pip3 install --upgrade pip && pip install --no-cache-dir -r requirements.txt +WORKDIR /app +COPY . /app + +# Creates a non-root user and adds permission to access the /app folder +RUN adduser -u 5678 --disabled-password --gecos "" appuser && chown -R appuser /app +USER appuser + +# Gunicorn RUN pip install --no-cache-dir gunicorn +# During debugging, this entry point will be overridden. For more information, please refer to https://aka.ms/vscode-docker-python-debug CMD ["python", "-m", "gunicorn", "redeyes.wsgi", "-b", "0.0.0.0:8000"]