-
Notifications
You must be signed in to change notification settings - Fork 1
44 lines (40 loc) · 1.01 KB
/
docker.yaml
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
name: Builld and push container images
on:
pull_request:
branches:
- main
paths:
- argocd/apps/foo/src/**
- argocd/apps/bar/src/**
push:
branches:
- main
permissions:
id-token: write
contents: read
jobs:
image-build-and-push:
runs-on: ubuntu-22.04
strategy:
matrix:
service: [
"foo",
"bar"
]
steps:
- uses: actions/checkout@v4
- uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: ${{ vars.AWS_IAM_ROLE_ARN }}
aws-region: ${{ vars.AWS_REGION }}
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2
- name: Builld and push ${{ matrix['service'] }} image
env:
REGISTRY: ${{ steps.login-ecr.outputs.registry }}
SERVICE: ${{ matrix['service'] }}
IMAGE_TAG: ${{ github.sha }}
run: |
docker build -t $REGISTRY/$SERVICE:$IMAGE_TAG ./argocd/apps/${SERVICE}/src/
docker push $REGISTRY/$SERVICE:$IMAGE_TAG