Skip to content

Commit 6c87fb2

Browse files
committed
Github Action: Docker Build and Push
1 parent 6fcdc43 commit 6c87fb2

File tree

1 file changed

+25
-17
lines changed

1 file changed

+25
-17
lines changed

.github/workflows/docker-hub.yml

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,29 +13,37 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
-
16-
name: Login to DockerHub
17-
# The job will terminate early if Docker Hub credentials is not set.
18-
uses: docker/login-action@v1
16+
name: Checkout
17+
uses: actions/checkout@v3
18+
-
19+
name: Docker meta
20+
uses: docker/metadata-action@v4
21+
id: meta
22+
with:
23+
images: |
24+
fossasia/open-event-frontend
25+
tags: |
26+
type=ref,event=branch
27+
type=ref,event=pr
28+
type=semver,pattern={{version}}
29+
type=semver,pattern={{major}}.{{minor}}
30+
-
31+
name: Login to Docker Hub
32+
uses: docker/login-action@v2
1933
with:
2034
username: ${{ secrets.DOCKERHUB_USERNAME }}
2135
password: ${{ secrets.DOCKERHUB_TOKEN }}
2236
-
23-
name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v1
37+
name: Set up QEMU
38+
uses: docker/setup-qemu-action@v2
2539
-
26-
name: Docker meta
27-
uses: docker/metadata-action@v3
28-
id: meta
29-
with:
30-
images: fossasia/open-event-frontend
40+
name: Set up Buildx
41+
uses: docker/setup-buildx-action@v2
3142
-
32-
name: Build
33-
id: docker_build
34-
uses: docker/build-push-action@v2
43+
name: Build and push
44+
uses: docker/build-push-action@v4
3545
with:
36-
push: true
46+
context: .
47+
push: ${{ github.event_name != 'pull_request' }}
3748
tags: ${{ steps.meta.outputs.tags }}
3849
labels: ${{ steps.meta.outputs.labels }}
39-
-
40-
name: Image digest
41-
run: echo ${{ steps.docker_build.outputs.digest }}

0 commit comments

Comments
 (0)