Skip to content

Commit 517f2b9

Browse files
Create docker-image.yml
1 parent bd591fd commit 517f2b9

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: Docker Build and Push
2+
3+
on:
4+
push:
5+
branches:
6+
- github-actions # Change this to the branch you want to trigger the action on
7+
8+
jobs:
9+
build-and-push:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Login to Docker Hub
17+
run: docker login -u ${{ secrets.DOCKERHUB_USERNAME }} -p ${{ secrets.DOCKERHUB_TOKEN }}
18+
19+
- name: Build and Push Docker Image
20+
env:
21+
DOCKER_IMAGE_TAG: "my-docker-image:latest" # Change this to your desired image tag
22+
run: |
23+
docker build -t $DOCKER_IMAGE_TAG .
24+
docker tag $DOCKER_IMAGE_TAG ${{ secrets.DOCKERHUB_USERNAME }}/$DOCKER_IMAGE_TAG
25+
docker push ${{ secrets.DOCKERHUB_USERNAME }}/$DOCKER_IMAGE_TAG
26+

0 commit comments

Comments
 (0)