Add Docker image support
This commit is contained in:
13
.dockerignore
Normal file
13
.dockerignore
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
.cache/
|
||||||
|
.git/
|
||||||
|
.pytest_cache/
|
||||||
|
.venv/
|
||||||
|
__pycache__/
|
||||||
|
logs/
|
||||||
|
output/
|
||||||
|
temp/
|
||||||
|
*.log
|
||||||
|
*.mp3
|
||||||
|
*.mp4
|
||||||
|
*.pyc
|
||||||
|
*.wav
|
||||||
24
Dockerfile
Normal file
24
Dockerfile
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
FROM python:3.10-slim
|
||||||
|
|
||||||
|
ENV PYTHONDONTWRITEBYTECODE=1 \
|
||||||
|
PYTHONUNBUFFERED=1 \
|
||||||
|
GRADIO_SERVER_NAME=0.0.0.0 \
|
||||||
|
PORT=7860
|
||||||
|
|
||||||
|
WORKDIR /app
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y --no-install-recommends ffmpeg ca-certificates \
|
||||||
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY requirements.txt .
|
||||||
|
RUN pip install --no-cache-dir --upgrade pip \
|
||||||
|
&& pip install --no-cache-dir -r requirements.txt
|
||||||
|
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
RUN mkdir -p .cache temp output logs/gradio
|
||||||
|
|
||||||
|
EXPOSE 7860
|
||||||
|
|
||||||
|
CMD ["python", "web_app.py"]
|
||||||
25
README.md
25
README.md
@@ -76,6 +76,31 @@ Gradio provides a local browser UI for starting dub jobs, watching logs, and dow
|
|||||||
|
|
||||||
Open `http://127.0.0.1:7860` and submit a YouTube URL. Jobs run through the same `main.py` pipeline, so the CLI options and environment variables still apply.
|
Open `http://127.0.0.1:7860` and submit a YouTube URL. Jobs run through the same `main.py` pipeline, so the CLI options and environment variables still apply.
|
||||||
|
|
||||||
|
### Docker
|
||||||
|
|
||||||
|
Build and run the Gradio UI in a container:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
docker build -t youtube-auto-dub:gradio .
|
||||||
|
docker run --rm -p 7860:7860 `
|
||||||
|
-e LM_STUDIO_BASE_URL=http://host.docker.internal:1234/v1 `
|
||||||
|
-e LM_STUDIO_API_KEY=lm-studio `
|
||||||
|
-e LM_STUDIO_MODEL=gemma-3-4b-it `
|
||||||
|
-v ${PWD}\.cache:/app/.cache `
|
||||||
|
-v ${PWD}\output:/app/output `
|
||||||
|
-v ${PWD}\logs:/app/logs `
|
||||||
|
-v ${PWD}\temp:/app/temp `
|
||||||
|
youtube-auto-dub:gradio
|
||||||
|
```
|
||||||
|
|
||||||
|
Or use Compose:
|
||||||
|
|
||||||
|
```powershell
|
||||||
|
docker compose up --build
|
||||||
|
```
|
||||||
|
|
||||||
|
When LM Studio runs on the host machine, use `http://host.docker.internal:1234/v1` from inside Docker instead of `http://127.0.0.1:1234/v1`.
|
||||||
|
|
||||||
Override the LM Studio endpoint or model from the CLI:
|
Override the LM Studio endpoint or model from the CLI:
|
||||||
|
|
||||||
```powershell
|
```powershell
|
||||||
|
|||||||
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
services:
|
||||||
|
youtube-auto-dub:
|
||||||
|
build: .
|
||||||
|
image: youtube-auto-dub:gradio
|
||||||
|
ports:
|
||||||
|
- "7860:7860"
|
||||||
|
environment:
|
||||||
|
LM_STUDIO_BASE_URL: "http://host.docker.internal:1234/v1"
|
||||||
|
LM_STUDIO_API_KEY: "lm-studio"
|
||||||
|
LM_STUDIO_MODEL: "gemma-3-4b-it"
|
||||||
|
volumes:
|
||||||
|
- ./.cache:/app/.cache
|
||||||
|
- ./output:/app/output
|
||||||
|
- ./logs:/app/logs
|
||||||
|
- ./temp:/app/temp
|
||||||
@@ -327,4 +327,6 @@ app = create_app()
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.launch(server_name="127.0.0.1", server_port=7860)
|
server_name = os.getenv("GRADIO_SERVER_NAME", "127.0.0.1")
|
||||||
|
server_port = int(os.getenv("PORT", "7860"))
|
||||||
|
app.launch(server_name=server_name, server_port=server_port)
|
||||||
|
|||||||
Reference in New Issue
Block a user