Skip to content

Commit ad40404

Browse files
Update docker-image.yml
1 parent 92cb77c commit ad40404

1 file changed

Lines changed: 25 additions & 22 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,26 @@
1-
name: Build and Push Docker Image to Docker Hub
2-
3-
on: push
1+
name: Build Docker Image
2+
on:
3+
push:
4+
branches:
5+
- main
46
jobs:
5-
push_to_registry:
6-
name: push docker image to hub
7-
runs-on: ubuntu-latest
8-
steps:
9-
- name: check repository
10-
uses: actions/checkout@v4
11-
12-
- name: login to docker registry
13-
uses: docker/login-action@v3
14-
with:
15-
username: ${{secrets.DOCKERHUB_USERNAME}}
16-
password: ${{secrets.DOCKERHUB_TOKEN}}
17-
18-
- name: build and push docker image to registry
19-
uses: docker/build-push-action@v5
20-
with:
21-
context: DockerFileFolder/
22-
push: true
23-
tags: fadillahrizki/notes-backend:latest
7+
build:
8+
name: push docker image to docker hub
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: login to docker hub
13+
id: docker-hub
14+
env:
15+
username: ${{secrets.DOCKERHUB_USERNAME}}
16+
password: ${{secrets.DOCKERHUB_TOKEN}}
17+
run: |
18+
docker login -u $username -p $password
19+
- name: build the docker image
20+
id: build-docker-image
21+
run: |
22+
ls -la
23+
docker build . -f Dockerfile -t fadillahrizki/notes-backend:latest
24+
- name: push the docker image
25+
id: push-docker-image
26+
run: docker push ${{secrets.DOCKERHUB_USERNAME}}/notes-backend:latest

0 commit comments

Comments
 (0)