Fix docker crontab

parent 899a950b
......@@ -27,7 +27,7 @@ build/
dist/
node_modules/
docs/_build/
docker/nginx/collect/
docker/nginx/collect/static/*
docker/env
htmlcov/
......
......@@ -5,7 +5,7 @@ RUN apt-get update &&\
\
# Extra deps
cron \
python3-pip
python3-pip
# Base deps
RUN pip3 install \
......@@ -37,7 +37,6 @@ COPY [ \
"boilerplate.ini", \
"manage.py", \
"tasks.py", \
"temp_cron", \
"/app/" \
]
......@@ -46,6 +45,18 @@ COPY src/ /app/src/
ENV PYTHONPATH=src \
SMI_UNB_PRODUCTION=true
# Setting crontab
RUN crontab temp_cron && rm temp_cron
RUN crontab -l
\ No newline at end of file
ADD scripts/start.sh /bin/start.sh
# Collecting Static Files
RUN python3 manage.py collectstatic --noinput
# Setting cron
ADD crontab /etc/cron.d/smi-cron
RUN chmod 0644 /etc/cron.d/smi-cron
RUN touch /var/log/cron.log
RUN /usr/bin/crontab /etc/cron.d/smi-cron
CMD /bin/bash /bin/start.sh
* * * * * export $(cat /root/env | xargs) && python3 /app/manage.py runcrons smi_unb.data_reader.cronjob.DataCollectCronJob
# Empty endline to make this cron valid.
......@@ -22,7 +22,6 @@ services:
env_file: ./docker/env
volumes:
- ./src/:/app/src/
command: bash -c "inv run_web_container"
postgres:
restart: always
......
# export all environment variables to use in cron
env | sed 's/^\(.*\)$/ \1/g' > /root/env
# initializing cron and gunicorn
cron && \
python3 manage.py makemigrations && \
python3 manage.py migrate && \
python3 manage.py loaddata src/smi_unb/fixtures/initial_data.json && \
gunicorn smi_unb.wsgi -b 0.0.0.0:8000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment