-
Notifications
You must be signed in to change notification settings - Fork 3
57 lines (48 loc) · 1.59 KB
/
build_and_push_docker_image.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
45
46
47
48
49
50
51
52
53
54
55
56
57
name: Build and Push Multi-Arch Docker Image
on:
push:
branches:
- main
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
id-token: write
contents: read
issues: write
steps:
- name: Check out repository
uses: actions/checkout@v2
- name: Extract version from Chart.yaml
id: extract_version
run: |
VERSION=$(awk -F": " '/appVersion:/ {print $2}' ./helm-chart/Chart.yaml | tr -d '"')
echo "Extracted version: $VERSION"
echo "::set-output name=version::$VERSION"
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: arn:aws:iam::479353902725:role/gha-flexera-public-cbi-oi-kubecost-exporter-push
aws-region: us-east-1
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registry-type: public
registries: public.ecr.aws/flexera
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
buildkitd-flags: --debug
- name: Build and push multi-arch Docker image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: |
public.ecr.aws/flexera/cbi-oi-kubecost-exporter:${{ steps.extract_version.outputs.version }}
public.ecr.aws/flexera/cbi-oi-kubecost-exporter:latest