-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (46 loc) · 1.48 KB
/
github-action-main.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
name: Build and push Docker images
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
strategy:
matrix:
image:
- api-gateway
- chatbot
- instance-service
- instance-streaming-service
- mailer
- project-service
- user-service
- web
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set up Docker
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- id: repo_name
name: Prepare image tag path
run: echo "LOWER_GITHUB_REPOSITORY=${GITHUB_REPOSITORY,,}" >> $GITHUB_OUTPUT
env:
GITHUB_REPOSITORY: ${{ github.repository }}
- name: Build and push ${{ matrix.image }}
run: |
if [ "${{ matrix.image }}" = "web" ]; then
docker build -t ghcr.io/${{ steps.repo_name.outputs.LOWER_GITHUB_REPOSITORY }}/${{ matrix.image }}:latest -f web/Dockerfile .
else
docker build -t ghcr.io/${{ steps.repo_name.outputs.LOWER_GITHUB_REPOSITORY }}/${{ matrix.image }}:latest -f cmd/${{ matrix.image }}/Dockerfile .
fi
docker push ghcr.io/${{ steps.repo_name.outputs.LOWER_GITHUB_REPOSITORY }}/${{ matrix.image }}:latest