forked from kamba4/sunders
All checks were successful
Build (and tag) Images / build (push) Successful in 35s
57 lines
No EOL
1.8 KiB
YAML
57 lines
No EOL
1.8 KiB
YAML
name: Build (and tag) Images
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.hamburg.ccc.de
|
|
username: ${{ secrets.REGISTRY_USERNAME }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Set image tags
|
|
id: vars
|
|
run: |
|
|
if [ "${{ github.ref_name }}" = "main" ] && [ "${{ github.event_name }}" = "push" ]; then
|
|
echo "tag=latest" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
- name: Build images
|
|
run: |
|
|
pushd ./web
|
|
docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/web:${{ steps.vars.outputs.tag }} .
|
|
popd
|
|
pushd ./data_handler
|
|
docker build -f ./Containerfile -t git.hamburg.ccc.de/ccchh/sunders/data_handler:${{ steps.vars.outputs.tag }} .
|
|
popd
|
|
|
|
- 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' && github.ref_name == 'main'
|
|
|
|
- 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
|
|
run: |
|
|
docker compose up -d --wait
|
|
docker compose down |