Skip to content

Commit fd5b451

Browse files
committed
GHA on push
1 parent ba58de1 commit fd5b451

File tree

2 files changed

+62
-0
lines changed

2 files changed

+62
-0
lines changed
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: MultiArchDockerBuild
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- feature/docker-container
8+
9+
jobs:
10+
docker:
11+
name: Build multi-arch Docker image.
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: tag number
15+
run : echo ${{ github.event.release.tag_name }}
16+
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Set up QEMU
21+
uses: docker/setup-qemu-action@v3
22+
23+
- name: Set up Docker Buildx
24+
id: buildx
25+
uses: docker/setup-buildx-action@v3
26+
with:
27+
install: true
28+
29+
- name: Login to DockerHub
30+
uses: docker/login-action@v3
31+
with:
32+
username: ${{ secrets.DOCKERHUB_USERNAME }}
33+
password: ${{ secrets.DOCKERHUB_TOKEN }}
34+
35+
- name: Login to GitHub Container Registry
36+
uses: docker/login-action@v3
37+
with:
38+
registry: ghcr.io
39+
username: ${{ github.repository_owner }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
42+
- name: Set lower case owner name
43+
run: |
44+
echo "REG_REPO=${REPO,,}" >> ${GITHUB_ENV}
45+
env:
46+
REPO: '${{ github.repository }}'
47+
48+
- name: Check env
49+
run: |
50+
echo ${{ env.REG_REPO }}
51+
52+
- name: Build and push
53+
uses: docker/build-push-action@v5
54+
with:
55+
context: .
56+
platforms: linux/amd64,linux/arm64,linux/arm/v7
57+
push: true
58+
tags: |
59+
${{ secrets.DOCKERHUB_USERNAME }}/jacred:latest
60+
ghcr.io/${{ env.REG_REPO }}:latest
61+
cache-from: type=gha,scope=${{ github.workflow }}
62+
cache-to: type=gha,mode=max,scope=${{ github.workflow }}

0 commit comments

Comments
 (0)