Nope137 commited on
Commit
d3ea2cd
·
1 Parent(s): 9368964

REAL FIX: Updated Dockerfile and removed .dockerignore

Browse files
Files changed (4) hide show
  1. .dockerignore +0 -79
  2. Dockerfile +30 -19
  3. README.md +2 -3
  4. config_templates/README.md +7 -0
.dockerignore DELETED
@@ -1,79 +0,0 @@
1
- # User config & backup
2
- /conf.yaml
3
- # Avatars
4
- # avatars/*
5
- # Backgrounds
6
- # backgrounds/*
7
-
8
- /conf.yaml.backup
9
-
10
- # Default templates retained
11
- !/config_templates/**
12
-
13
- # Live2D models - ignore non-defaults
14
- live2d-models/*
15
- !live2d-models/mao_pro/**
16
- !live2d-models/shizuku/**
17
-
18
- # Characters
19
- characters/*
20
- # All default characters tracked via git
21
-
22
-
23
-
24
- # System files
25
- .DS_Store
26
-
27
- # Python cache
28
- __pycache__/
29
- *.pyc
30
-
31
- # IDE & local files
32
- /.idea/
33
- lab.py
34
-
35
- # Virtual envs
36
- .venv/
37
- .conda/
38
- conda/
39
-
40
- # API keys, secrets
41
- .env
42
- api_keys.py
43
- src/open_llm_vtuber/llm/user_credentials.json
44
-
45
- # Database
46
- memory.db*
47
- mem.json
48
-
49
- # Logs
50
- server.log
51
- logs/*
52
-
53
- # Cache & models
54
- cache/*
55
- asset/
56
- models/*
57
- !models/piper_voice/**
58
- src/open_llm_vtuber/tts/asset/
59
- src/open_llm_vtuber/tts/config/
60
- src/open_llm_vtuber/asr/models/*
61
- !src/open_llm_vtuber/asr/models/silero_vad.onnx
62
-
63
- # Misc
64
- tmp/
65
- private/
66
- legacy/
67
- chat_history/
68
- knowledge_base/
69
- submodules/MeloTTS
70
- openapi_*.json
71
-
72
- # Windows builds
73
- *.exe
74
-
75
- # Packaging artifacts
76
- *.egg-info/
77
- build/
78
- dist/
79
- .cache/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
Dockerfile CHANGED
@@ -1,5 +1,6 @@
1
  FROM python:3.10-slim
2
 
 
3
  ENV DEBIAN_FRONTEND=noninteractive \
4
  PYTHONDONTWRITEBYTECODE=1 \
5
  PYTHONUNBUFFERED=1 \
@@ -7,33 +8,43 @@ ENV DEBIAN_FRONTEND=noninteractive \
7
  UV_LINK_MODE=copy \
8
  CONFIG_FILE=/app/conf.yaml
9
 
10
- # Create a user to match Hugging Face requirements
11
- RUN useradd -m -u 1000 user
12
- WORKDIR /app
13
-
14
- # Base dependencies
15
  RUN apt-get update && apt-get install -y --no-install-recommends \
16
  ffmpeg git curl ca-certificates \
17
  && rm -rf /var/lib/apt/lists/*
18
 
19
- # Install uv
20
  COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
21
 
22
- # Set ownership of the app directory to the user
23
- RUN chown user:user /app
24
- USER user
 
 
 
 
 
 
25
 
26
- # Install deps
27
- COPY --chown=user pyproject.toml uv.lock ./
28
- RUN uv sync --frozen --no-dev
 
 
 
 
 
 
 
 
 
 
29
 
30
- # Copy source
31
- COPY --chown=user . /app
32
- RUN uv pip install --no-deps .
33
 
34
- # Simplify the startup logic
35
- # Ensure you actually HAVE a conf.yaml in your root folder before pushing!
36
  EXPOSE 7860
37
 
38
- # Run the server directly on port 7860
39
- CMD ["uv", "run", "run_server.py", "--port", "7860", "--host", "0.0.0.0"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 1. Set Environment Variables
4
  ENV DEBIAN_FRONTEND=noninteractive \
5
  PYTHONDONTWRITEBYTECODE=1 \
6
  PYTHONUNBUFFERED=1 \
 
8
  UV_LINK_MODE=copy \
9
  CONFIG_FILE=/app/conf.yaml
10
 
11
+ # 2. Install System Dependencies
 
 
 
 
12
  RUN apt-get update && apt-get install -y --no-install-recommends \
13
  ffmpeg git curl ca-certificates \
14
  && rm -rf /var/lib/apt/lists/*
15
 
16
+ # 3. Install UV
17
  COPY --from=ghcr.io/astral-sh/uv:latest /uv /uvx /usr/local/bin/
18
 
19
+ # 4. Set up the workspace
20
+ WORKDIR /app
21
+
22
+ # 5. Copy specific files one by one to ensure they exist
23
+ COPY pyproject.toml /app/
24
+ COPY uv.lock /app/
25
+ COPY run_server.py /app/
26
+ COPY conf.yaml /app/
27
+ COPY . /app
28
 
29
+ # 6. INSTALL DEPENDENCIES AS ROOT (This is the fix)
30
+ RUN uv pip install --system .
31
+
32
+ # 7. Create the Hugging Face User
33
+ RUN useradd -m -u 1000 user
34
+
35
+ # 8. Fix Permissions & Git Ownership
36
+ RUN chown -R user:user /app && \
37
+ chmod -R 775 /app && \
38
+ git config --global --add safe.directory /app
39
+
40
+ # 9. Switch to the non-root user for security
41
+ USER user
42
 
43
+ # 10. Sanity Check
44
+ RUN ls -la /app/conf.yaml && ls -la /app/run_server.py
 
45
 
46
+ # 11. Network Configuration
 
47
  EXPOSE 7860
48
 
49
+ # 12. Start the Application
50
+ CMD ["python", "run_server.py"]
README.md CHANGED
@@ -3,9 +3,8 @@ title: Open LLM
3
  emoji: 🚀
4
  colorFrom: blue
5
  colorTo: green
6
- sdk: streamlit
7
- sdk_version: 1.31.0
8
- app_file: app.py
9
  pinned: false
10
  ---
11
  ![](./assets/banner.jpg)
 
3
  emoji: 🚀
4
  colorFrom: blue
5
  colorTo: green
6
+ sdk: docker
7
+ app_port: 7860
 
8
  pinned: false
9
  ---
10
  ![](./assets/banner.jpg)
config_templates/README.md ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+
2
+ # Config Template
3
+
4
+ This directory contains the default configuration files. One of the configuration file, `conf.default.yaml` by default, will be copied to the root directory of this project as `conf.yaml`.
5
+
6
+ Do not modify the content of these template unless you are contributing to this project.
7
+