-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (55 loc) · 1.68 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
name: Build Docker image
on:
push:
branches:
- main
- master
tags:
- '*'
env:
IMAGE_NAME: ios-aurora-push
NODE_VERSION: 18
jobs:
build-and-push-image:
runs-on: [self-hosted, linux]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Extract short git hash
id: vars
run: |
echo sha_short=$(echo $GITHUB_SHA | head -c7) >> $GITHUB_OUTPUT
echo branch_name=$(echo ${GITHUB_REF##*/}) >> $GITHUB_OUTPUT
echo TS=$(date +%s) >> $GITHUB_OUTPUT
- name: Log in to the Container registry
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
with:
registries: '072270118115'
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ steps.login-ecr.outputs.registry }}/${{ env.IMAGE_NAME }}
tags: |
type=sha,prefix=${{ steps.vars.outputs.branch_name }}-,suffix=-${{ steps.vars.outputs.ts }}
type=ref,event=branch
type=ref,event=tag
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Setup docker context for buildx
id: buildx-context
run: docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
endpoint: builders
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
push: true
file: Dockerfile
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64, linux/arm64