henry000 commited on
Commit
ea07ae6
·
1 Parent(s): 853bfba

👷 [Add] A workflow for deploying docker image

Browse files
Files changed (1) hide show
  1. .github/workflows/docker.yaml +42 -0
.github/workflows/docker.yaml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Docker Image Deploy to DockerHub
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ build:
11
+ runs-on: ubuntu-latest
12
+
13
+ steps:
14
+ - name: Checkout repository
15
+ uses: actions/checkout@v3
16
+
17
+ - name: Set up Docker Buildx
18
+ uses: docker/setup-buildx-action@v3
19
+
20
+ - name: Log in to Docker Hub
21
+ uses: docker/login-action@v2
22
+ with:
23
+ username: ${{ secrets.DOCKER_USERNAME }}
24
+ password: ${{ secrets.DOCKER_PASSWORD }}
25
+
26
+ - name: Extract metadata (tags, labels) for Docker
27
+ id: meta
28
+ uses: docker/metadata-action@v4
29
+ with:
30
+ images: ${{ secrets.DOCKER_USERNAME }}/yolo
31
+
32
+ - name: Build and push Docker image
33
+ uses: docker/build-push-action@v4
34
+ with:
35
+ context: docker
36
+ file: docker/Dockerfile
37
+ push: true
38
+ tags: ${{ steps.meta.outputs.tags }}
39
+ labels: ${{ steps.meta.outputs.labels }}
40
+
41
+ - name: Image digest
42
+ run: echo ${{ steps.meta.outputs.digest }}