File tree 3 files changed +27
-2
lines changed
3 files changed +27
-2
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Publish Docker Image to Docker Hub
2
+
3
+ on :
4
+ push :
5
+ branches : ["main"]
6
+
7
+ jobs :
8
+ build :
9
+ runs-on : ubuntu-latest
10
+
11
+ steps :
12
+ - uses : actions/checkout@v3
13
+
14
+ - name : DockerHub Login
15
+ uses : docker/login-action@v2.1.0
16
+ with :
17
+ username : ${{ secrets.DOCKERHUB_USERNAME }}
18
+ password : ${{ secrets.DOCKERHUB_PASSWORD }}
19
+
20
+ - name : Build the Docker image
21
+ run : docker build . --file Dockerfile --tag ${{ secrets.DOCKERHUB_USERNAME }}/devops
22
+
23
+ - name : Docker Push
24
+ run : docker push ${{ secrets.DOCKERHUB_USERNAME }}/devops
Original file line number Diff line number Diff line change 1
- FROM nginx:1.23.2
1
+ FROM nginx:1.23.3-alpine
2
2
WORKDIR /usr/share/nginx/html
3
3
COPY . .
4
4
EXPOSE 80
Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ version: '3.9'
2
2
3
3
services :
4
4
devops-website :
5
- container_name : website
5
+ container_name : devops- website
6
6
build :
7
7
context : .
8
8
dockerfile : Dockerfile
9
+ image : devops-website
9
10
ports :
10
11
- 8000:80
You can’t perform that action at this time.
0 commit comments