Changes and docker config
Some checks failed
continuous-integration/drone Build is failing

This commit is contained in:
Kevin Alberts 2024-01-23 15:09:09 +01:00
parent 9e324537c3
commit fa6550bcf5
4 changed files with 66 additions and 5 deletions

17
.drone.yml Normal file
View file

@ -0,0 +1,17 @@
---
kind: pipeline
type: docker
name: default
steps:
- name: build
image: plugins/docker
settings:
registry: git.kurocon.nl
username:
from_secret: docker_username
password:
from_secret: docker_password
repo: git.kurocon.nl/kurocon/davinci
tags:
- latest

27
Dockerfile Normal file
View file

@ -0,0 +1,27 @@
# Then build the actual amelie docker image
FROM python:latest
# Set /usr/src/app as startup working directory
WORKDIR /usr/src/app
# Install python requirements
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
# Make dirs
RUN mkdir -p /static /config
# Copy sources
COPY . .
# Check if Django can run
RUN python3 manage.py check
# Expose volumes
VOLUME ["/static", "/config"]
# Expose the web port
EXPOSE 8000
# Start the website
CMD ["/usr/src/app/start.sh"]

View file

@ -20,11 +20,15 @@ class Command(BaseCommand):
if sync.last_sync is None or timezone.now() > (sync.last_sync + sync.sync_interval):
logger.debug(f"Synchronizing {sync.name}...")
events = sync.get_events()
added, existing, unchanged, deleted = sync.target.upload_events(events, purge=sync.purge)
try:
events = sync.get_events()
added, existing, unchanged, deleted = sync.target.upload_events(events, purge=sync.purge)
sync.last_sync = timezone.now()
sync.save()
logger.debug(f"Sync for {sync.name} done! {added} events added, {existing} updated. {unchanged} unchanged, and {deleted} purged.")
sync.last_sync = timezone.now()
sync.save()
logger.debug(f"Sync for {sync.name} done! {added} events added, {existing} updated. {unchanged} unchanged, and {deleted} purged.")
except Exception as e:
print(f"Exception during execution of ical_sync for {sync.name}")
raise e
logger.debug("iCal sync complete!")

13
start.sh Normal file
View file

@ -0,0 +1,13 @@
#!/bin/sh
# Copy configuration to proper place
cp "/config/local.py" "/usr/src/app/davinci/local.py"
# Make sure staticfiles are collected into the static volume
python3 manage.py collectstatic --noinput
# Make sure database is migrated
python3 manage.py migrate
# Start django server (ASGI)
daphne -b 0.0.0.0 -p 8080 davinci.asgi:application