1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-07-28 09:19:37 +02:00
AdventureLog/backend/Dockerfile

46 lines
1.2 KiB
Text
Raw Normal View History

2024-07-08 11:44:39 -04:00
# Dockerfile
FROM python:3.10-slim
LABEL Developers="Sean Morley"
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1
# Set the working directory
WORKDIR /code
# Install system dependencies
RUN apt-get update \
2024-08-20 14:37:18 -04:00
&& apt-get install -y git postgresql-client cron \
2024-07-08 11:44:39 -04:00
&& apt-get clean
# Install Python dependencies
COPY ./server/requirements.txt /code/
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
# Copy the Django project code into the Docker image
COPY ./server /code/
2024-08-20 14:37:18 -04:00
# Collect static files
RUN python3 manage.py collectstatic --noinput --verbosity 2
# Setup cron to run python3 manage.py worldtravel-seed every day at 00:00
RUN echo "0 0 * * * python3 /code/manage.py worldtravel-seed --force >> /var/log/cron.log 2>&1" > /etc/cron.d/worldtravel-seed
# Give execution rights on the cron job
RUN chmod 0644 /etc/cron.d/worldtravel-seed
# Apply cron job
RUN crontab /etc/cron.d/worldtravel-seed
# Ensure cron is started in the foreground when the container starts
CMD ["cron", "-f"]
2024-07-09 09:58:52 -04:00
2024-07-08 11:44:39 -04:00
# Set the entrypoint script
COPY ./entrypoint.sh /code/entrypoint.sh
RUN chmod +x /code/entrypoint.sh
2024-08-20 14:37:18 -04:00
ENTRYPOINT ["/code/entrypoint.sh"]