-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (60 loc) · 1.94 KB
/
docker-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
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: Login to Google Artifact Registry
uses: docker/login-action@v2
with:
registry: europe-west12-docker.pkg.dev
username: _json_key
password: ${{ secrets.GCP_SA_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 }}