Files
matitos_news/app_urls/Dockerfile
Luciano Gervasoni b112da8bd0 Supervisor based run
2025-07-22 00:51:09 +02:00

33 lines
782 B
Docker
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
FROM python:3.12
# Prevents Python from writing pyc files to disk
ENV PYTHONDONTWRITEBYTECODE=1
#Prevents Python from buffering stdout and stderr
ENV PYTHONUNBUFFERED=1
# supervisor
RUN apt-get update && apt-get install -y supervisor
# User
RUN useradd -m -r appuser && \
mkdir /opt/app && \
chown -R appuser /opt/app
WORKDIR /opt/app
# Copy the Django project and install dependencies
COPY requirements.txt /opt/app/
# Install dependencies
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=appuser:appuser . /opt/app/
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
RUN chmod -R 755 /opt
RUN chown -R appuser:appuser /opt
USER appuser
# Run Djangos server & workers
CMD ["sh", "-c", "/opt/app/initialize.sh && /usr/bin/supervisord"]