Skip to content

Commit 5de028d

Browse files
authored
Create publish-docker-image.yaml
1 parent aabadbc commit 5de028d

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Build and Push Docker Image
2+
on:
3+
workflow_dispatch: # Allow manual runs too
4+
5+
jobs:
6+
build-and-push:
7+
runs-on: ubuntu-latest
8+
steps:
9+
# Step 1: Checkout the repo
10+
- name: Checkout code
11+
uses: actions/checkout@v4
12+
# Step 2: Log in to Docker Hub
13+
- name: Log in to Docker Hub
14+
uses: docker/login-action@v3
15+
with:
16+
username: ${{ secrets.DOCKER_USERNAME }}
17+
password: ${{ secrets.DOCKER_PASSWORD }}
18+
# Step 3: Set up Docker Buildx
19+
- name: Set up Docker Buildx
20+
uses: docker/setup-buildx-action@v3
21+
# Step 4: Build and push the image
22+
- name: Build and push Docker image
23+
uses: docker/build-push-action@v5
24+
with:
25+
context: .
26+
push: true
27+
tags: ${{ secrets.DOCKER_USERNAME }}/gh-demo:latest

0 commit comments

Comments
 (0)