Skip to content

Commit 214e8e9

Browse files
committed
Add GitHub Actions for automated Docker builds
- Auto-build and push to ghcr.io on push to main - docker-compose.yml now uses pre-built image by default - Users can docker pull ghcr.io/fspecii/heartmula-studio:latest - Supports version tags on releases - Build caching for faster CI
1 parent c2a8f38 commit 214e8e9

File tree

3 files changed

+85
-5
lines changed

3 files changed

+85
-5
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'Dockerfile'
8+
- 'docker-compose.yml'
9+
- 'backend/**'
10+
- 'frontend/**'
11+
- '.github/workflows/docker-publish.yml'
12+
release:
13+
types: [published]
14+
workflow_dispatch: # Allow manual trigger
15+
16+
env:
17+
REGISTRY: ghcr.io
18+
IMAGE_NAME: ${{ github.repository }}
19+
20+
jobs:
21+
build-and-push:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: read
25+
packages: write
26+
27+
steps:
28+
- name: Checkout repository
29+
uses: actions/checkout@v4
30+
31+
- name: Set up Docker Buildx
32+
uses: docker/setup-buildx-action@v3
33+
34+
- name: Log in to Container Registry
35+
uses: docker/login-action@v3
36+
with:
37+
registry: ${{ env.REGISTRY }}
38+
username: ${{ github.actor }}
39+
password: ${{ secrets.GITHUB_TOKEN }}
40+
41+
- name: Extract metadata (tags, labels)
42+
id: meta
43+
uses: docker/metadata-action@v5
44+
with:
45+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
46+
tags: |
47+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
48+
type=semver,pattern={{version}}
49+
type=semver,pattern={{major}}.{{minor}}
50+
type=sha,prefix=
51+
52+
- name: Build and push Docker image
53+
uses: docker/build-push-action@v5
54+
with:
55+
context: .
56+
push: true
57+
tags: ${{ steps.meta.outputs.tags }}
58+
labels: ${{ steps.meta.outputs.labels }}
59+
cache-from: type=gha
60+
cache-to: type=gha,mode=max
61+
platforms: linux/amd64

README.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ The easiest way to run HeartMuLa Studio - no Python/Node setup required.
139139
### Quick Start with Docker
140140

141141
```bash
142-
# Clone and start
142+
# Clone and start (uses pre-built image from GitHub Container Registry)
143143
git clone https://github.com/fspecii/HeartMuLa-Studio.git
144144
cd HeartMuLa-Studio
145145
docker compose up -d
@@ -150,6 +150,23 @@ docker compose logs -f
150150

151151
Open **http://localhost:8000**
152152

153+
### Alternative: Pull and Run Directly
154+
155+
```bash
156+
# Create directories for persistent data
157+
mkdir -p backend/models backend/generated_audio backend/ref_audio
158+
159+
# Run the pre-built image
160+
docker run -d \
161+
--gpus all \
162+
-p 8000:8000 \
163+
-v ./backend/models:/app/backend/models \
164+
-v ./backend/generated_audio:/app/backend/generated_audio \
165+
-v ./backend/ref_audio:/app/backend/ref_audio \
166+
--name heartmula-studio \
167+
ghcr.io/fspecii/heartmula-studio:latest
168+
```
169+
153170
### What Happens on First Run
154171

155172
1. Docker builds the image (~10GB, includes CUDA + PyTorch)

docker-compose.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
services:
22
heartmula:
3-
build:
4-
context: .
5-
dockerfile: Dockerfile
6-
image: heartmula-studio:latest
3+
# Use pre-built image from GitHub Container Registry (faster)
4+
image: ghcr.io/fspecii/heartmula-studio:latest
5+
# Or build locally: uncomment the lines below and comment out the image line above
6+
# build:
7+
# context: .
8+
# dockerfile: Dockerfile
79
container_name: heartmula-studio
810

911
# GPU access - requires NVIDIA Container Toolkit

0 commit comments

Comments
 (0)