forked from kamba4/sunders
Merge pull request 'Branch-specific image tagging' (#8) from pwd into container
All checks were successful
Build (and tag) Images / build (push) Successful in 34s
All checks were successful
Build (and tag) Images / build (push) Successful in 34s
Reviewed-on: #8
This commit is contained in:
commit
8d5b74a773
2 changed files with 29 additions and 12 deletions
|
@ -1,9 +1,8 @@
|
||||||
name: Build Hello World Image
|
name: Build (and tag) Images
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
|
@ -23,17 +22,36 @@ jobs:
|
||||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||||
|
|
||||||
- name: Build and push web image to Container Registry
|
- name: Set image tags
|
||||||
|
id: vars
|
||||||
run: |
|
run: |
|
||||||
docker build -f ./web/Containerfile -t git.hamburg.ccc.de/ccchh/sunders/web:latest .
|
if [ "${{ github.ref_name }}" = "main" ] && [ "${{ github.event_name }}" = "push" ]; then
|
||||||
docker push git.hamburg.ccc.de/ccchh/sunders/web:latest
|
echo "tag=latest" >> $GITHUB_OUTPUT
|
||||||
|
else
|
||||||
- name: Build and push data_handler image to Container Registry
|
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Build web image
|
||||||
run: |
|
run: |
|
||||||
docker build -f ./data_handler/Containerfile -t git.hamburg.ccc.de/ccchh/sunders/data_handler:latest .
|
docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }} .
|
||||||
docker push git.hamburg.ccc.de/ccchh/sunders/data_handler:latest
|
working-directory: ./web
|
||||||
|
|
||||||
|
- name: Build data_handler image
|
||||||
|
run: |
|
||||||
|
docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }} .
|
||||||
|
working-directory: ./data_handler
|
||||||
|
|
||||||
|
- name: Push images to Container Registry
|
||||||
|
run: |
|
||||||
|
docker push git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }}
|
||||||
|
docker push git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }}
|
||||||
|
if: github.event_name == 'push'
|
||||||
|
|
||||||
|
- name: Update docker-compose.yml image tags
|
||||||
|
run: |
|
||||||
|
sed -i "s/:latest/:${{ steps.vars.outputs.tag }}/g" docker-compose.yml
|
||||||
|
|
||||||
- name: Start Docker Compose services
|
- name: Start Docker Compose services
|
||||||
run: |
|
run: |
|
||||||
docker compose up -d --wait
|
docker compose up -d --wait
|
||||||
docker compose down
|
docker compose down
|
|
@ -1,4 +1,3 @@
|
||||||
version: '3.8'
|
|
||||||
services:
|
services:
|
||||||
db:
|
db:
|
||||||
image: mariadb:12.0.2
|
image: mariadb:12.0.2
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue