File tree Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Expand file tree Collapse file tree 1 file changed +46
-0
lines changed Original file line number Diff line number Diff line change
1
+ name : Build and Push Docker Image
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main # 在推送到 main 分支时触发
7
+ pull_request :
8
+ branches :
9
+ - main # 在对 main 分支的 PR 时触发
10
+
11
+ jobs :
12
+ build-and-push :
13
+ runs-on : ubuntu-latest
14
+
15
+ steps :
16
+ - name : Checkout repository
17
+ uses : actions/checkout@v2
18
+
19
+ - name : Set up Docker Buildx
20
+ uses : docker/setup-buildx-action@v1
21
+
22
+ - name : Log in to Docker Hub
23
+ uses : docker/login-action@v2
24
+ with :
25
+ username : ${{ secrets.DOCKER_USERNAME }}
26
+ password : ${{ secrets.DOCKER_PASSWORD }}
27
+
28
+ - name : Cache Docker layers
29
+ uses : actions/cache@v2
30
+ with :
31
+ path : /tmp/.buildx-cache
32
+ key : ${{ runner.os }}-buildx-${{ github.sha }}
33
+ restore-keys : |
34
+ ${{ runner.os }}-buildx-
35
+
36
+ - name : Build and push Docker image
37
+ uses : docker/build-push-action@v2
38
+ with :
39
+ context : .
40
+ file : ./Dockerfile
41
+ push : true
42
+ tags : ${{ secrets.DOCKER_USERNAME }}/code_interpreter:latest
43
+
44
+ - name : Clean up Docker images
45
+ run : |
46
+ docker image prune -f
You can’t perform that action at this time.
0 commit comments