Supervisor based run
This commit is contained in:
@@ -5,6 +5,9 @@ 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 && \
|
||||
@@ -14,10 +17,11 @@ WORKDIR /opt/app
|
||||
|
||||
# Copy the Django project and install dependencies
|
||||
COPY requirements.txt /opt/app/
|
||||
# run this command to install all dependencies
|
||||
# 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
|
||||
@@ -25,4 +29,4 @@ RUN chown -R appuser:appuser /opt
|
||||
USER appuser
|
||||
|
||||
# Run Django’s server & workers
|
||||
CMD ["sh", "-c", "/opt/app/initialize.sh && /opt/app/run.sh"]
|
||||
CMD ["sh", "-c", "/opt/app/initialize.sh && /usr/bin/supervisord"]
|
||||
|
||||
Reference in New Issue
Block a user