diff --git a/.github/workflows/build-and-publish.yml b/.github/workflows/build-and-publish.yml new file mode 100644 index 0000000..e8b569b --- /dev/null +++ b/.github/workflows/build-and-publish.yml @@ -0,0 +1,23 @@ +name: "Build and Publish Docker Image" + +on: + workflow_dispatch: + push: + branches: + - "main" + paths: + - "**" + +jobs: + workflow: + uses: chnm/.github/.github/workflows/django--build-publish.yml@main + secrets: inherit + with: + + container-registry: "ghcr.io" + container-image-name: "winterthur" + + django-context-root: "." + + website-devl-fqdn: "dev.winterthur.rrchnm.org" + website-prod-fqdn: "dev.winterthur.rrchnm.org" diff --git a/docker-compose.yml.j2 b/docker-compose.yml.j2 index 3a0e8c6..e8acef6 100644 --- a/docker-compose.yml.j2 +++ b/docker-compose.yml.j2 @@ -3,9 +3,8 @@ --- services: app: - build: . - image: "rrchnm/winterthur" - container_name: "winterthur-app" + image: ghcr.io/{{ template.git.package.image_name }}:{{ template.git.package.tag }} + container_name: {{ template.name }}_app restart: unless-stopped env_file: .env ports: @@ -17,13 +16,14 @@ services: poetry run python3 manage.py collectstatic --no-input && poetry run python3 manage.py runserver 0.0.0.0:8000" volumes: - - dj-data:/app/staticfiles + - dj-static:/app/staticfiles + - dj-media:/app/media depends_on: db: condition: service_healthy db: image: postgres:12 - container_name: "winterthur-db" + container_name: {{ template.name }}_db restart: unless-stopped env_file: .env volumes: @@ -36,9 +36,12 @@ services: # external volumes managed and defined by ansible volumes: - dj-data: - name: "winterthur_app-vol" + dj-static: + name: "{{ template.name }}_app-static-vol" + external: true + dj-media: + name: "{{ template.name }}_app-media-vol" external: true pg-data: - name: "winterthur_db-vol" + name: "{{ template.name }}_db-vol" external: true