Skip to content

docker-REGION

docker-REGION #6

Workflow file for this run

name: Docker Build and Push
on:
push:
branches: [ main ]
paths:
- 'telegram_bot_service/**'
- 'translation_service/**'
- 'transport_service/**'
- '.github/workflows/docker-build.yml'
workflow_dispatch:
inputs:
service:
description: 'Service to build'
required: true
type: choice
options:
- telegram_bot_service
- translation_service
- transport_service
jobs:
build-and-push:
runs-on: ubuntu-latest
strategy:
matrix:
service:
- telegram_bot_service
- translation_service
- transport_service
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Google Auth
id: auth
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: Login to Google Artifact Registry
uses: docker/login-action@v2
with:
registry: ${{ secrets.GCP_REGION }}-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: Build and push to Docker Hub
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.service }}
push: true
tags: |
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.service }}:latest
${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.service }}:${{ github.sha }}
- name: Build and push to Google Artifact Registry
uses: docker/build-push-action@v6
with:
context: ./${{ matrix.service }}
push: true
tags: |
europe-west12-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ matrix.service }}/${{ matrix.service }}:latest
europe-west12-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/${{ matrix.service }}/${{ matrix.service }}:${{ github.sha }}