Skip to content

Commit

Permalink
Merge pull request #261 from seanmorley15/development
Browse files Browse the repository at this point in the history
chron and CZ
  • Loading branch information
seanmorley15 authored Aug 20, 2024
2 parents 3b936f7 + 027956a commit 0f4cf33
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
19 changes: 16 additions & 3 deletions backend/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ WORKDIR /code

# Install system dependencies
RUN apt-get update \
&& apt-get install -y git postgresql-client \
&& apt-get install -y git postgresql-client cron \
&& apt-get clean

# Install Python dependencies
Expand All @@ -24,9 +24,22 @@ RUN pip install -r requirements.txt
# Copy the Django project code into the Docker image
COPY ./server /code/

RUN python3 manage.py collectstatic --verbosity 2
# 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"]

# Set the entrypoint script
COPY ./entrypoint.sh /code/entrypoint.sh
RUN chmod +x /code/entrypoint.sh
ENTRYPOINT ["/code/entrypoint.sh"]
ENTRYPOINT ["/code/entrypoint.sh"]
14 changes: 14 additions & 0 deletions backend/server/worldtravel/management/commands/worldtravel-seed.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def handle(self, *args, **options):
('Switzerland', 'ch', 'EU'),
('Italy', 'it', 'EU'),
('Iceland', 'is', 'EU'),
('Czech Republic', 'cz', 'EU'),
]

regions = [
Expand Down Expand Up @@ -523,6 +524,19 @@ def handle(self, *args, **options):
('IS-6', 'Norðurland eystra', 'is'),
('IS-7', 'Austurland', 'is'),
('IS-8', 'Suðurland', 'is'),
('CZ-20', 'Středočeský kraj', 'cz'),
('CZ-31', 'Jihočeský kraj', 'cz'),
('CZ-32', 'Plzeňský kraj', 'cz'),
('CZ-41', 'Karlovarský kraj', 'cz'),
('CZ-42', 'Ústecký kraj', 'cz'),
('CZ-51', 'Liberecký kraj', 'cz'),
('CZ-52', 'Královéhradecký kraj', 'cz'),
('CZ-53', 'Pardubický kraj', 'cz'),
('CZ-63', 'Kraj Vysočina', 'cz'),
('CZ-64', 'Jihomoravský kraj', 'cz'),
('CZ-71', 'Olomoucký kraj', 'cz'),
('CZ-72', 'Zlínský kraj', 'cz'),
('CZ-80', 'Moravskoslezský kraj', 'cz'),
]


Expand Down

0 comments on commit 0f4cf33

Please sign in to comment.