forked from apache/polaris
-
Notifications
You must be signed in to change notification settings - Fork 0
37 lines (28 loc) · 1.02 KB
/
docker-build-push.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
name: Build and Push Docker Container
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
env:
IMAGE_VERSION: $(date +'%Y%m%d_%H%M%S')_${{ github.sha }}_${{ github.run_number }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GitHub Container Registry
run: echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
- name: Build and push multi-platform Docker image
run: |
# Build and tag the Docker image with the version
docker buildx create --use
docker buildx build --push \
--tag ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]'):${{ env.IMAGE_VERSION }} \
--platform linux/amd64,linux/arm64 .
env:
DOCKER_CLI_ACI_AS_TEXT: "true"