Skip to content

Commit a9bf0b4

Browse files
committed
feat(github-ci): add docker image build
1 parent 227b964 commit a9bf0b4

1 file changed

Lines changed: 50 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build docker image
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
env:
9+
PROJECT_NAME: UnityNuGet
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-image:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout repository
22+
uses: actions/checkout@v3
23+
24+
- name: Set up QEMU
25+
uses: docker/setup-qemu-action@v2
26+
27+
- name: Set up Docker Buildx
28+
uses: docker/setup-buildx-action@v2
29+
30+
- name: Log in to the Container registry
31+
uses: docker/login-action@v2
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- name: Extract metadata (tags, labels) for Docker
38+
id: meta
39+
uses: docker/metadata-action@v4
40+
with:
41+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v4
45+
with:
46+
context: .
47+
push: true
48+
platforms: linux/amd64,linux/arm64
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)