Skip to content

Commit 73b12ba

Browse files
yzoaimhiyouga
andauthored
[workflow] auto push docker images (#8181)
Co-authored-by: hoshi-hiyouga <[email protected]>
1 parent 55d37dc commit 73b12ba

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/push_docker.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: push_docker
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- "main"
8+
paths:
9+
- "**/*.py"
10+
- "requirements.txt"
11+
- "docker/**"
12+
- ".github/workflows/*.yml"
13+
pull_request:
14+
branches:
15+
- "main"
16+
paths:
17+
- "**/*.py"
18+
- "requirements.txt"
19+
- "docker/**"
20+
- ".github/workflows/*.yml"
21+
22+
jobs:
23+
build:
24+
runs-on: ubuntu-latest
25+
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
29+
30+
environment:
31+
name: docker
32+
url: https://hub.docker.com/r/hiyouga/llamafactory
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Set up Docker Buildx
39+
uses: docker/setup-buildx-action@v3
40+
41+
- name: Login to Docker Hub
42+
if: github.event_name != 'pull_request'
43+
uses: docker/login-action@v3
44+
with:
45+
username: ${{ vars.DOCKERHUB_USERNAME }}
46+
password: ${{ secrets.DOCKERHUB_TOKEN }}
47+
48+
- name: Build and push Docker image
49+
uses: docker/build-push-action@v6
50+
with:
51+
context: .
52+
file: ./docker/docker-cuda/Dockerfile
53+
build-args: |
54+
EXTRAS=metrics,deepspeed,liger-kernel
55+
push: ${{ github.event_name != 'pull_request' }}
56+
tags: docker.io/hiyouga/llamafactory:latest
57+
cache-from: type=gha
58+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)