Skip to content

Commit fd9b4d5

Browse files
authored
Add Docker CI workflow for building and pushing images
1 parent 73a0ebf commit fd9b4d5

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/main.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Docker CI Demo
2+
3+
on:
4+
push:
5+
branches:
6+
- 'master'
7+
tags:
8+
- '**'
9+
10+
jobs:
11+
push:
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
18+
- name: Docker meta
19+
id: docker_meta
20+
uses: crazy-max/ghaction-docker-meta@v3
21+
with:
22+
images: msj6785/nodejs-ci
23+
tag-semver: |
24+
{{version}}
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Login to Docker Hub
33+
uses: docker/login-action@v3
34+
with:
35+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
36+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
37+
38+
- name: Build and push Docker Image
39+
uses: docker/build-push-action@v5
40+
with:
41+
context: .
42+
push: true
43+
tags: ${{ steps.docker_meta.outputs.tags }}
44+
labels: ${{ steps.docker_meta.outputs.labels }}

0 commit comments

Comments
 (0)