Run the Django control panel with Gunicorn instead of the development runserver and serve static files through WhiteNoise. Add restart policies, healthchecks, .env-driven production settings, and a sample .env file for single-server deployments. Update the Docker entrypoint to collect static assets and document the remote server deployment and update flow in the README.
28 lines
834 B
Docker
28 lines
834 B
Docker
FROM python:3.12-slim
|
|
|
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
PYTHONUNBUFFERED=1 \
|
|
PIP_NO_CACHE_DIR=1
|
|
|
|
RUN apt-get update \
|
|
&& apt-get install -y --no-install-recommends rsync openssh-client cron default-libmysqlclient-dev build-essential pkg-config \
|
|
&& rm -rf /var/lib/apt/lists/*
|
|
|
|
WORKDIR /app
|
|
|
|
COPY pyproject.toml README.md ./
|
|
COPY src ./src
|
|
COPY manage.py ./
|
|
COPY scripts/docker-entrypoint ./scripts/docker-entrypoint
|
|
|
|
RUN python -m pip install --upgrade pip \
|
|
&& python -m pip install -e ".[mariadb]"
|
|
|
|
RUN mkdir -p /opt/pobsync/config/hosts /opt/pobsync/state/locks /opt/pobsync/logs /var/lib/pobsync
|
|
RUN chmod +x ./scripts/docker-entrypoint
|
|
|
|
EXPOSE 8000
|
|
|
|
ENTRYPOINT ["./scripts/docker-entrypoint"]
|
|
CMD ["gunicorn", "pobsync_server.wsgi:application", "--bind", "0.0.0.0:8000", "--workers", "2", "--timeout", "120"]
|