Update to gitea actions
Build and Push Docker Images / build-and-push (./admin_ui, admin_ui) (push) Successful in 1m23s
Build and Push Docker Images / build-and-push (./auth_api, auth_api) (push) Successful in 1m2s
Build and Push Docker Images / build-and-push (./employee_api, employee_api) (push) Successful in 1m6s
Build and Push Docker Images / build-and-push (./error_log_api, error_log_api) (push) Successful in 1m13s
Build and Push Docker Images / build-and-push (./transit_api, transit_api) (push) Successful in 1m1s
Build and Push Docker Images / build-and-push (./admin_ui, admin_ui) (push) Successful in 1m23s
Build and Push Docker Images / build-and-push (./auth_api, auth_api) (push) Successful in 1m2s
Build and Push Docker Images / build-and-push (./employee_api, employee_api) (push) Successful in 1m6s
Build and Push Docker Images / build-and-push (./error_log_api, error_log_api) (push) Successful in 1m13s
Build and Push Docker Images / build-and-push (./transit_api, transit_api) (push) Successful in 1m1s
This commit is contained in:
@@ -0,0 +1,78 @@
|
||||
name: Build and Push Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
paths:
|
||||
- "auth_api/**"
|
||||
- "employee_api/**"
|
||||
- "transit_api/**"
|
||||
- "error_log_api/**"
|
||||
- "admin_ui/**"
|
||||
- ".gitea/workflows/docker-build.yml"
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
|
||||
env:
|
||||
REGISTRY: gitea.testinstance.nl
|
||||
IMAGE_NAMESPACE: sven/the-transit-project
|
||||
|
||||
jobs:
|
||||
build-and-push:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: auth_api
|
||||
context: ./auth_api
|
||||
- name: employee_api
|
||||
context: ./employee_api
|
||||
- name: transit_api
|
||||
context: ./transit_api
|
||||
- name: error_log_api
|
||||
context: ./error_log_api
|
||||
- name: admin_ui
|
||||
context: ./admin_ui
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Gitea Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ secrets.REGISTRY_USERNAME }}
|
||||
password: ${{ secrets.REGISTRY_PASSWORD }}
|
||||
|
||||
- name: Set image tags
|
||||
id: tags
|
||||
shell: bash
|
||||
run: |
|
||||
image_base="${{ env.REGISTRY }}/${{ env.IMAGE_NAMESPACE }}/${{ matrix.name }}"
|
||||
image_tags="${image_base}:${{ gitea.sha }}"
|
||||
|
||||
if [[ "${{ gitea.event_name }}" == "push" && "${{ gitea.ref_name }}" == "main" ]]; then
|
||||
image_tags+=$'\n'"${image_base}:latest"
|
||||
fi
|
||||
|
||||
{
|
||||
echo 'tags<<EOF'
|
||||
echo "$image_tags"
|
||||
echo 'EOF'
|
||||
} >> "$GITHUB_OUTPUT"
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: ${{ matrix.context }}
|
||||
push: ${{ gitea.event_name == 'push' }}
|
||||
tags: ${{ steps.tags.outputs.tags }}
|
||||
@@ -1,239 +0,0 @@
|
||||
name: Build and Push Docker Images
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
paths:
|
||||
- 'auth_api/**'
|
||||
- 'employee_api/**'
|
||||
- 'transit_api/**'
|
||||
- 'error_log_api/**'
|
||||
- 'admin_ui/**'
|
||||
- '.github/workflows/docker-build.yml'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- develop
|
||||
|
||||
env:
|
||||
# GitHub Container Registry
|
||||
REGISTRY: ghcr.io
|
||||
# Dockerhub alternative (uncomment to use instead)
|
||||
# REGISTRY: docker.io
|
||||
# REGISTRY_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
|
||||
jobs:
|
||||
build-auth-api:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
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: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
# For DockerHub, use instead:
|
||||
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/auth_api
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./auth_api
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-employee-api:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
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: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/employee_api
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./employee_api
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-transit-api:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
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: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/transit_api
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./transit_api
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-error-log-api:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
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: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/error_log_api
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./error_log_api
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
build-admin-ui:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
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: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ github.repository }}/admin_ui
|
||||
tags: |
|
||||
type=ref,event=branch
|
||||
type=semver,pattern={{version}}
|
||||
type=semver,pattern={{major}}.{{minor}}
|
||||
type=sha,prefix={{branch}}-
|
||||
type=raw,value=latest,enable={{is_default_branch}}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: ./admin_ui
|
||||
push: ${{ github.event_name != 'pull_request' }}
|
||||
tags: ${{ steps.meta.outputs.tags }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
+6
-6
@@ -1,4 +1,4 @@
|
||||
version: '3.9'
|
||||
version: "3.9"
|
||||
services:
|
||||
error_log_api:
|
||||
build:
|
||||
@@ -17,7 +17,7 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
auth_api:
|
||||
image: ghcr.io/sven491/xtransit/auth_api:latest
|
||||
image: ${REGISTRY_HOST:-gitea.testinstance.nl}/${IMAGE_NAMESPACE:-sven/the-transit-project}/auth_api:${IMAGE_TAG:-latest}
|
||||
container_name: auth_api
|
||||
ports:
|
||||
- "5000:5000"
|
||||
@@ -37,7 +37,7 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
employee_api:
|
||||
image: ghcr.io/sven491/xtransit/employee_api:latest
|
||||
image: ${REGISTRY_HOST:-gitea.testinstance.nl}/${IMAGE_NAMESPACE:-sven/the-transit-project}/employee_api:${IMAGE_TAG:-latest}
|
||||
container_name: employee_api
|
||||
ports:
|
||||
- "4000:4000"
|
||||
@@ -54,7 +54,7 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
transit_api:
|
||||
image: ghcr.io/sven491/xtransit/transit_api:latest
|
||||
image: ${REGISTRY_HOST:-gitea.testinstance.nl}/${IMAGE_NAMESPACE:-sven/the-transit-project}/transit_api:${IMAGE_TAG:-latest}
|
||||
container_name: transit_api
|
||||
ports:
|
||||
- "5001:5001"
|
||||
@@ -73,7 +73,7 @@ services:
|
||||
restart: unless-stopped
|
||||
|
||||
admin_ui:
|
||||
image: ghcr.io/sven491/xtransit/admin_ui:latest
|
||||
image: ${REGISTRY_HOST:-gitea.testinstance.nl}/${IMAGE_NAMESPACE:-sven/the-transit-project}/admin_ui:${IMAGE_TAG:-latest}
|
||||
container_name: admin_ui
|
||||
ports:
|
||||
- "5174:80"
|
||||
@@ -85,4 +85,4 @@ services:
|
||||
- auth_api
|
||||
- transit_api
|
||||
- error_log_api
|
||||
restart: unless-stopped
|
||||
restart: unless-stopped
|
||||
|
||||
Reference in New Issue
Block a user