Skip to content

Commit e8ab135

Browse files
committed
first commit
0 parents  commit e8ab135

File tree

9 files changed

+1750
-0
lines changed

9 files changed

+1750
-0
lines changed

.github/workflows/build.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
workflow_dispatch: # Allow manual trigger
9+
10+
env:
11+
REGISTRY: ghcr.io
12+
IMAGE_NAME: kokoro-fastapi-serverless
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
21+
steps:
22+
- name: Checkout repository
23+
uses: actions/checkout@v4
24+
25+
- name: Log in to Container Registry
26+
uses: docker/login-action@v3
27+
with:
28+
registry: ${{ env.REGISTRY }}
29+
username: ${{ github.actor }}
30+
password: ${{ secrets.GITHUB_TOKEN }}
31+
32+
- name: Extract metadata
33+
id: meta
34+
uses: docker/metadata-action@v5
35+
with:
36+
images: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}
37+
tags: |
38+
type=ref,event=branch
39+
type=ref,event=pr
40+
type=raw,value=latest,enable={{is_default_branch}}
41+
type=sha
42+
43+
- name: Build and push Docker image
44+
uses: docker/build-push-action@v5
45+
with:
46+
context: .
47+
file: ./Dockerfile.wrapper
48+
push: true
49+
tags: ${{ steps.meta.outputs.tags }}
50+
labels: ${{ steps.meta.outputs.labels }}
51+
52+
- name: Output image URL
53+
run: |
54+
echo "🎉 Image built and pushed successfully!"
55+
echo "📦 Image URL: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest"
56+
echo ""
57+
echo "🚀 To use in RunPod:"
58+
echo " Image: ${{ env.REGISTRY }}/${{ github.repository_owner }}/${{ env.IMAGE_NAME }}:latest"

.gitignore

Lines changed: 283 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,283 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
share/python-wheels/
24+
*.egg-info/
25+
.installed.cfg
26+
*.egg
27+
MANIFEST
28+
29+
# PyInstaller
30+
# Usually these files are written by a python script from a template
31+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
32+
*.manifest
33+
*.spec
34+
35+
# Installer logs
36+
pip-log.txt
37+
pip-delete-this-directory.txt
38+
39+
# Unit test / coverage reports
40+
htmlcov/
41+
.tox/
42+
.nox/
43+
.coverage
44+
.coverage.*
45+
.cache
46+
nosetests.xml
47+
coverage.xml
48+
*.cover
49+
*.py,cover
50+
.hypothesis/
51+
.pytest_cache/
52+
cover/
53+
54+
# Translations
55+
*.mo
56+
*.pot
57+
58+
# Django stuff:
59+
*.log
60+
local_settings.py
61+
db.sqlite3
62+
db.sqlite3-journal
63+
64+
# Flask stuff:
65+
instance/
66+
.webassets-cache
67+
68+
# Scrapy stuff:
69+
.scrapy
70+
71+
# Sphinx documentation
72+
docs/_build/
73+
74+
# PyBuilder
75+
.pybuilder/
76+
target/
77+
78+
# Jupyter Notebook
79+
.ipynb_checkpoints
80+
81+
# IPython
82+
profile_default/
83+
ipython_config.py
84+
85+
# pyenv
86+
# For a library or package, you might want to ignore these files since the code is
87+
# intended to run in multiple environments; otherwise, check them in:
88+
# .python-version
89+
90+
# pipenv
91+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
92+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
93+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
94+
# install all needed dependencies.
95+
#Pipfile.lock
96+
97+
# poetry
98+
# Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
99+
# This is especially recommended for binary packages to ensure reproducibility, and is more
100+
# commonly ignored for libraries.
101+
# https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
102+
#poetry.lock
103+
104+
# pdm
105+
# Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
106+
#pdm.lock
107+
# pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
108+
# in version control.
109+
# https://pdm.fming.dev/#use-with-ide
110+
.pdm.toml
111+
112+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
113+
__pypackages__/
114+
115+
# Celery stuff
116+
celerybeat-schedule
117+
celerybeat.pid
118+
119+
# SageMath parsed files
120+
*.sage.py
121+
122+
# Environments
123+
.env
124+
.venv
125+
env/
126+
venv/
127+
ENV/
128+
env.bak/
129+
venv.bak/
130+
131+
# Spyder project settings
132+
.spyderproject
133+
.spyproject
134+
135+
# Rope project settings
136+
.ropeproject
137+
138+
# mkdocs documentation
139+
/site
140+
141+
# mypy
142+
.mypy_cache/
143+
.dmypy.json
144+
dmypy.json
145+
146+
# Pyre type checker
147+
.pyre/
148+
149+
# pytype static type analyzer
150+
.pytype/
151+
152+
# Cython debug symbols
153+
cython_debug/
154+
155+
# PyCharm
156+
# JetBrains specific template is maintained in a separate JetBrains.gitignore that can
157+
# be added to the global gitignore or merged into this project gitignore. For a PyCharm
158+
# project, it is common to ignore these files as they are specific to your machine:
159+
#.idea/
160+
161+
# Docker
162+
.dockerignore
163+
Dockerfile*
164+
docker-compose*.yml
165+
docker-compose*.yaml
166+
167+
# Keep our wrapper files
168+
!Dockerfile.wrapper
169+
170+
# Audio test files generated by tests
171+
*.mp3
172+
*.wav
173+
*.opus
174+
*.flac
175+
*.pcm
176+
test_*.mp3
177+
test_*.wav
178+
test_*.opus
179+
test_*.flac
180+
wrapper_test_*
181+
combined_voice_*.pt
182+
183+
# Temporary files
184+
*.tmp
185+
*.temp
186+
.DS_Store
187+
Thumbs.db
188+
189+
# Logs
190+
*.log
191+
logs/
192+
193+
# IDE files
194+
.vscode/
195+
.idea/
196+
*.swp
197+
*.swo
198+
*~
199+
200+
# OS generated files
201+
.DS_Store
202+
.DS_Store?
203+
._*
204+
.Spotlight-V100
205+
.Trashes
206+
ehthumbs.db
207+
Thumbs.db
208+
209+
# Node.js (if any frontend components)
210+
node_modules/
211+
npm-debug.log*
212+
yarn-debug.log*
213+
yarn-error.log*
214+
215+
# Model files (these are large and should be downloaded during build)
216+
*.pth
217+
*.pt
218+
*.ckpt
219+
*.bin
220+
*.safetensors
221+
models/
222+
model_cache/
223+
224+
# Backup files
225+
*.bak
226+
*.backup
227+
*~
228+
229+
# Jupyter notebook outputs
230+
*.ipynb_checkpoints/
231+
232+
# FastAPI specific
233+
.pytest_cache/
234+
__pycache__/
235+
236+
# Local development
237+
.env.local
238+
.env.development.local
239+
.env.test.local
240+
.env.production.local
241+
242+
# API keys and secrets
243+
api_keys.txt
244+
secrets.txt
245+
*.key
246+
*.pem
247+
248+
# Local testing output
249+
output.mp3
250+
output.wav
251+
output.opus
252+
output.flac
253+
test_output.*
254+
255+
# Editor backup files
256+
*.orig
257+
258+
# Profiling data
259+
*.prof
260+
261+
# Temporary internet files
262+
Temporary Internet Files/
263+
264+
# Runtime data
265+
pids
266+
*.pid
267+
*.seed
268+
*.pid.lock
269+
270+
# Coverage directory used by tools like istanbul
271+
coverage/
272+
*.lcov
273+
274+
# Ignore original API schema (keeping our serverless version)
275+
api_schema.json
276+
277+
# Build artifacts
278+
dist/
279+
build/
280+
281+
# Local configuration
282+
config.local.*
283+
settings.local.*

Dockerfile.wrapper

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Use the existing working Kokoro FastAPI image as base
2+
FROM ghcr.io/remsky/kokoro-fastapi-gpu:latest
3+
4+
# Switch to root to install additional packages
5+
USER root
6+
7+
# Install runpod and any additional dependencies
8+
RUN pip install runpod>=1.0.0
9+
10+
# Copy the serverless handler
11+
COPY handler-wrapper.py /app/handler.py
12+
13+
# Copy startup script
14+
COPY start-serverless.sh /app/start-serverless.sh
15+
RUN chmod +x /app/start-serverless.sh
16+
17+
# Switch back to appuser
18+
USER appuser
19+
20+
# Use the serverless startup script instead of the original entrypoint
21+
CMD ["/app/start-serverless.sh"]

0 commit comments

Comments
 (0)