Skip to content

Commit 08567d9

Browse files
authored
Update build-docker.yml
1 parent 9b47b25 commit 08567d9

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

.github/workflows/build-docker.yml

+29-15
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,40 @@
1-
name: Deploy
1+
name: Build and Push Docker Image
22

33
on:
44
push:
55
branches:
6-
- main
6+
- main
7+
8+
env:
9+
REGISTRY: docker.io
10+
IMAGE_NAME: my-image-name
711

812
jobs:
9-
deploy:
13+
build-and-push:
1014
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: read
18+
packages: read
19+
1120
steps:
12-
- name: Login to Docker Hub
13-
uses: docker/login-action@v3
14-
with:
15-
username: ${{ secrets.DOCKER_USERNAME }}
16-
password: ${{ secrets.DOCKER_PASSWORD }}
21+
- name: Checkout code
22+
uses: actions/checkout@v3
1723

18-
- name: Check repository contents
19-
run: ls -l # Verify Dockerfile presence
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v2
2026

21-
- name: Build and push Docker image
22-
uses: docker/build-push-action@v5
23-
with:
24-
push: true
25-
tags: vikram1202/picpilot:latest
27+
- name: Login to Docker Hub
28+
uses: docker/login-action@v2
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
32+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
2633

34+
- name: Build and push Docker image
35+
uses: docker/build-push-action@v5
36+
with:
37+
context: .
38+
push: true
39+
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
40+
dockerfile: Dockerfile

0 commit comments

Comments
 (0)