Skip to content

Commit 5aeda4e

Browse files
authored
Create docker.yml
1 parent 275f87d commit 5aeda4e

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

.github/workflows/docker.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Publish docker image to docker hub
2+
3+
on:
4+
push:
5+
branches: [ "main" ]
6+
pull_request:
7+
branches: [ "main" ]
8+
9+
jobs:
10+
build-and-push:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Log in to Docker Hub
17+
uses: docker/login-action@v2
18+
with:
19+
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
password: ${{ secrets.DOCKERHUB_TOKEN }}
21+
22+
- name: Build and push Docker image
23+
uses: docker/build-push-action@v5
24+
with:
25+
context: ./backend
26+
push: true
27+
tags: |
28+
${{ secrets.DOCKERHUB_USERNAME }}/vidsh:latest
29+
${{ secrets.DOCKERHUB_USERNAME }}/vidsh:${{ github.sha }}
30+
cache-from: type=registry,ref=${{ secrets.DOCKERHUB_USERNAME }}/vidsh:latest
31+
cache-to: type=inline

0 commit comments

Comments
 (0)