build fixes and static files fix, closes #28

This commit is contained in:
badblocks 2025-04-19 17:10:46 -07:00
parent bff2525c65
commit 6a44ef30a3
26 changed files with 91 additions and 39 deletions

View file

@ -1,14 +1,12 @@
# Pull base image
FROM python:3.12.2-bookworm
# Set environment variables (we want to write bytecode as we have multiple workers, so omit PYTHONDONTWRITEBYTECODE)
# (we want to write bytecode as we have multiple workers, so omit PYTHONDONTWRITEBYTECODE)
ENV PYTHONUNBUFFERED 1
ENV HOME /code
# Create and set work directory called `app`
RUN mkdir -p /code
WORKDIR /code
# Install dependencies
COPY requirements.txt /tmp/requirements.txt
RUN set -ex && \
@ -16,20 +14,16 @@ RUN set -ex && \
pip install -r /tmp/requirements.txt && \
rm -rf /root/.cache/
# Copy local project
COPY . /code/
COPY .env.production /code/.env
ENV HOME=/code
RUN apt-get update && apt-get install -y nodejs npm xvfb netcat-openbsd nano curl
# Install playwright (via pip and install script)
RUN playwright install-deps && playwright install
# Expose port 8000
COPY . /code/
COPY .env.production /code/.env
EXPOSE 8000
HEALTHCHECK CMD curl --fail http://localhost:8000 || exit 1
# Use gunicorn on port 8000
CMD ["gunicorn", "--bind", ":8000", "django_project.wsgi", "--workers", "4", "--worker-tmp-dir", "/dev/shm", "--timeout", "90"]
#CMD ["gunicorn", "--bind", ":8000", "django_project.wsgi", "--workers", "3", "--worker-class", "gevent", "--worker-connections", "1000", "--worker-tmp-dir", "/dev/shm", "--timeout", "90"]
CMD ["granian", "--interface", "wsgi", "django_project.wsgi", "--host", "0.0.0.0", "--port", "8000", "--workers", "1"]