-
Notifications
You must be signed in to change notification settings - Fork 4
75 lines (58 loc) · 2.41 KB
/
platefetcher_arm64v8_image_builder.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
#Workflow to build the docker image and push it to DockerHub and GHCR
name: Docker Build/Publish Image
on:
push:
branches: [ main ]
jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: read
packages: write
env:
#DockerHub
DOCKER_REGISTRY: docker.io
DOCKER_IMAGE: ${{ secrets.DOCKERHUB_USERNAME }}/demoplate
DOCKER_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_AT }}
#Github Container Repo
GHCR_REGISTRY: ghcr.io
GHCR_IMAGE: yashindane/platefetcher
GHCR_USERNAME: ${{ github.actor }}
GHCR_PASSWORD: ${{ secrets.TOK }}
TARGET_PLATFORM: linux/arm64/v8
steps:
- name: Checkout The Code
uses: actions/checkout@v1
- name: Set up Docker Buildx
uses: crazy-max/ghaction-docker-buildx@v1
with:
buildx-version: latest
- name: Prepare
if: success()
id: prepare
run: |
echo "platform=${TARGET_PLATFORM}" >> $GITHUB_OUTPUT
echo "docker_image_tag=${DOCKER_REGISTRY}/${DOCKER_IMAGE}" >> $GITHUB_OUTPUT
echo "ghcr_image_tag=${GHCR_REGISTRY}/${GHCR_IMAGE}" >> $GITHUB_OUTPUT
echo "version=${GITHUB_RUN_NUMBER}" >> $GITHUB_OUTPUT
#DockerHub
- name: Docker Login To DockerHub
if: success()
run: |
echo "${DOCKER_PASSWORD}" | docker login ${DOCKER_REGISTRY} --username "${DOCKER_USERNAME}" --password-stdin
#DockerHub
- name: Run Buildx (push image to DockerHub)
if: success()
run: |
docker buildx build --platform ${{ steps.prepare.outputs.platform }} -t ${{ steps.prepare.outputs.docker_image_tag }}:${{ steps.prepare.outputs.version }} --output type=image,push=true .
#GHCR
- name: Docker Login To GHCR
if: success()
run: |
echo "${GHCR_PASSWORD}" | docker login ${GHCR_REGISTRY} --username "${GHCR_USERNAME}" --password-stdin
#GHCR
- name: Run Buildx (push image to GHCR)
if: success()
run: |
docker buildx build --platform ${{ steps.prepare.outputs.platform }} -t ${{ steps.prepare.outputs.ghcr_image_tag }}:${{ steps.prepare.outputs.version }} --output type=image,push=true .