mirror of
https://github.com/hiyouga/LLaMA-Factory.git
synced 2025-07-31 10:42:50 +08:00
67 lines
1.6 KiB
YAML
67 lines
1.6 KiB
YAML
name: docker
|
|
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- "main"
|
|
paths:
|
|
- "**/*.py"
|
|
- "requirements.txt"
|
|
- "docker/**"
|
|
- ".github/workflows/*.yml"
|
|
pull_request:
|
|
branches:
|
|
- "main"
|
|
paths:
|
|
- "**/*.py"
|
|
- "requirements.txt"
|
|
- "docker/**"
|
|
- ".github/workflows/*.yml"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
environment:
|
|
name: docker
|
|
url: https://hub.docker.com/r/hiyouga/llamafactory
|
|
|
|
steps:
|
|
- name: Free up disk space
|
|
run: |
|
|
df -h
|
|
sudo rm -rf /usr/share/dotnet
|
|
sudo rm -rf /opt/ghc
|
|
sudo rm -rf /opt/hostedtoolcache
|
|
df -h
|
|
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login to Docker Hub
|
|
if: github.event_name != 'pull_request'
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ vars.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
file: ./docker/docker-cuda/Dockerfile
|
|
build-args: |
|
|
EXTRAS=metrics,deepspeed,liger-kernel
|
|
push: ${{ github.event_name != 'pull_request' }}
|
|
tags: docker.io/hiyouga/llamafactory:latest
|
|
cache-from: type=gha
|
|
cache-to: type=gha,mode=max
|