From b8820d2497a9ec2f77ab4d8b0e23d4591fb00c44 Mon Sep 17 00:00:00 2001 From: qtrinh2 Date: Thu, 23 May 2024 13:26:07 -0400 Subject: [PATCH 1/3] Create build-and-publish.yml --- .github/workflows/build-and-publish.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/build-and-publish.yml 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" From 02c847e5b29fd1f82b18b117de85f662129b12ad Mon Sep 17 00:00:00 2001 From: qtrinh2 Date: Thu, 23 May 2024 14:09:56 -0400 Subject: [PATCH 2/3] docker compose jinja template updates - using ghcr.io image - using template vars --- docker-compose.yml.j2 | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/docker-compose.yml.j2 b/docker-compose.yml.j2 index 3a0e8c6..6fc1e94 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: @@ -23,7 +22,7 @@ services: condition: service_healthy db: image: postgres:12 - container_name: "winterthur-db" + container_name: {{ template.name }}_db restart: unless-stopped env_file: .env volumes: @@ -37,8 +36,8 @@ services: # external volumes managed and defined by ansible volumes: dj-data: - name: "winterthur_app-vol" + name: "{{ template.name }}_app-vol" external: true pg-data: - name: "winterthur_db-vol" + name: "{{ template.name }}_db-vol" external: true From e4975d90b496a3c9b00bc9a7a7a62f3ce9f90d6b Mon Sep 17 00:00:00 2001 From: qtrinh2 Date: Thu, 23 May 2024 14:20:53 -0400 Subject: [PATCH 3/3] updating docker compose jinja template volumes --- docker-compose.yml.j2 | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/docker-compose.yml.j2 b/docker-compose.yml.j2 index 6fc1e94..e8acef6 100644 --- a/docker-compose.yml.j2 +++ b/docker-compose.yml.j2 @@ -16,7 +16,8 @@ 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 @@ -35,8 +36,11 @@ services: # external volumes managed and defined by ansible volumes: - dj-data: - name: "{{ template.name }}_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: "{{ template.name }}_db-vol"