-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (77 loc) · 2.55 KB
/
docker-image.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Docker Image CI
on:
push:
branches: ["master"]
env:
GHCR_REPO: ghcr.io/thegamerx1/website_backend
jobs:
build-docker:
strategy:
matrix:
cpu: [arm64, amd64]
include:
- cpu: arm64
runner: ARM64
tag: arm64
- cpu: amd64
runner: X64
tag: amd64
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }} # Automatically uses GitHub token for auth
- name: Build and Push Docker Image for arm
uses: docker/build-push-action@v5
with:
context: .
file: Dockerfile
provenance: false
platforms: linux/${{ matrix.cpu }}
push: true # Automatically push after build
tags: "${{ env.GHCR_REPO }}:${{ github.sha }}-${{ matrix.tag }}"
docker-manifest:
runs-on: ubuntu-latest
needs: [build-docker]
steps:
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: |
${{ env.GHCR_REPO }}
flavor: ${{ inputs.flavor }}
tags: ${{ inputs.tags }}
- name: Login to GitHub container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Create and push manifests
run: |
tags='${{ env.GHCR_REPO }}:${{ github.sha }} ${{ steps.meta.outputs.tags }}'
for tag in ${tags}
do
docker manifest rm ${tag} || true
docker manifest create ${tag} ${{ env.GHCR_REPO }}:${{ github.sha }}-amd64 ${{ env.GHCR_REPO }}:${{ github.sha }}-arm64
docker manifest push ${tag}
done
# - name: Upload release binary as artifact
# uses: actions/upload-artifact@v4
# with:
# name: agent-${{ matrix.os }}-${{ matrix.architecture }}
# path: release/*
# if-no-files-found: error
# build-docker:
# runs-on: windows-latest
# - name: Build the Docker image for amd64
# run: docker buildx build -t wakeonlan:latest-amd64 --platform linux/amd64 .
# - name: Build the Docker image for arm64
# run: docker buildx build -t wakeonlan:latest-arm64 --platform linux/arm64/v8 -f Dockerfile.arm .