Skip to content

Commit 94aa466

Browse files
committed
Build docker image when pushed to master
1 parent e50bde2 commit 94aa466

File tree

1 file changed

+22
-11
lines changed

1 file changed

+22
-11
lines changed

.github/workflows/docker-image.yml

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,46 @@ on:
44
push:
55
tags:
66
- '*'
7+
branches:
8+
- master
79

810
jobs:
911
docker:
1012
runs-on: ubuntu-latest
1113
steps:
12-
-
13-
name: Checkout
14+
- name: Checkout
1415
uses: actions/checkout@v3
15-
-
16-
name: Set up QEMU
16+
17+
- name: Set up QEMU
1718
uses: docker/setup-qemu-action@v2
18-
-
19-
name: Set up Docker Buildx
19+
20+
- name: Set up Docker Buildx
2021
uses: docker/setup-buildx-action@v2
21-
-
22-
name: Login to DockerHub
22+
23+
- name: Login to DockerHub
2324
uses: docker/login-action@v2
2425
with:
2526
username: mesudip
2627
password: ${{ secrets.DOCKERHUB_TOKEN }}
2728

28-
-
29-
name: Build and push
29+
- name: Build and push for tags
30+
if: startsWith(github.ref, 'refs/tags/')
3031
uses: docker/build-push-action@v3
3132
with:
3233
file: Dockerfile
3334
context: .
34-
platforms: linux/amd64, linux/arm64
35+
platforms: linux/amd64,linux/arm64
3536
push: true
3637
tags: |
3738
mesudip/nginx-proxy:${{ github.ref_name }}
3839
mesudip/nginx-proxy:latest
40+
41+
- name: Build and push for main branch
42+
if: github.ref == 'refs/heads/main'
43+
uses: docker/build-push-action@v3
44+
with:
45+
file: Dockerfile
46+
context: .
47+
platforms: linux/amd64,linux/arm64
48+
push: true
49+
tags: mesudip/nginx-proxy:${{ github.sha }}

0 commit comments

Comments
 (0)