Min num of sources filter, initialization scripts, docker ready to use dev mode
This commit is contained in:
@@ -19,31 +19,10 @@ RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY --chown=appuser:appuser . /opt/app/
|
||||
|
||||
RUN chmod -R 755 /opt/app
|
||||
RUN chown -R appuser:appuser /opt/app
|
||||
RUN chmod -R 755 /opt
|
||||
RUN chown -R appuser:appuser /opt
|
||||
|
||||
USER appuser
|
||||
|
||||
# Initialization script
|
||||
RUN echo '#!/bin/bash' > /opt/app/initialize.sh && \
|
||||
echo 'if [ "${INITIALIZE_DB}" = false ]; then' >> /opt/app/initialize.sh && \
|
||||
echo 'echo "Initialization not required"' >> /opt/app/initialize.sh && \
|
||||
echo 'else' >> /opt/app/initialize.sh && \
|
||||
echo 'echo "Initializating database"' >> /opt/app/initialize.sh && \
|
||||
echo 'python db.py --initialize_tables --initialize_data' >> /opt/app/initialize.sh && \
|
||||
echo 'python manage.py makemigrations fetcher; python manage.py migrate --fake-initial' >> /opt/app/initialize.sh && \
|
||||
echo 'python manage.py createsuperuser --noinput' >> /opt/app/initialize.sh && \
|
||||
echo 'python manage.py collectstatic --no-input' >> /opt/app/initialize.sh && \
|
||||
echo 'python manage.py import --filename scheduled_tasks.json' >> /opt/app/initialize.sh && \
|
||||
echo 'fi' >> /opt/app/initialize.sh && \
|
||||
chmod +x /opt/app/initialize.sh
|
||||
|
||||
# Serving script
|
||||
RUN echo '#!/bin/bash' > /opt/app/run.sh && \
|
||||
# Prod mode:
|
||||
echo 'gunicorn core.wsgi:application --bind 0.0.0.0:8000 & python manage.py rqworker high default low' >> /opt/app/run.sh && \
|
||||
# Dev mode:
|
||||
#echo 'gunicorn core.wsgi:application --reload --bind 0.0.0.0:8000 & python manage.py rqworker high default low' >> /opt/app/run.sh && \
|
||||
chmod +x /opt/app/run.sh
|
||||
|
||||
# Run Django’s server & workers
|
||||
CMD ["sh", "-c", "/opt/app/initialize.sh && /opt/app/run.sh"]
|
||||
CMD ["sh", "-c", "/opt/app/script_initialize.sh && /opt/app/script_run.sh"]
|
||||
|
||||
Reference in New Issue
Block a user