Spaces:
Paused
Paused
Create Dockerfile
Browse files- Dockerfile +37 -0
Dockerfile
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Open WebUI image
|
| 2 |
+
FROM ghcr.io/open-webui/open-webui:main
|
| 3 |
+
|
| 4 |
+
# ==============================================================
|
| 5 |
+
# 1. HUGGING FACE NETWORK REQUIREMENTS
|
| 6 |
+
# ==============================================================
|
| 7 |
+
# Hugging Face Spaces strictly routes external traffic to port 7860
|
| 8 |
+
ENV HOST=0.0.0.0
|
| 9 |
+
ENV PORT=7860
|
| 10 |
+
EXPOSE 7860
|
| 11 |
+
|
| 12 |
+
# ==============================================================
|
| 13 |
+
# 2. RESOURCE LIMITS (HF FREE TIER: 2 vCPU, 16GB RAM)
|
| 14 |
+
# ==============================================================
|
| 15 |
+
# Restrict to 2 workers to perfectly match the 2 free vCPUs (95% safety limit).
|
| 16 |
+
# This prevents the container from spawning too many threads and overloading the CPU.
|
| 17 |
+
ENV WEB_CONCURRENCY=2
|
| 18 |
+
ENV THREAD_POOL_SIZE=2
|
| 19 |
+
|
| 20 |
+
# Optimize memory allocation to prevent fragmentation
|
| 21 |
+
ENV MALLOC_ARENA_MAX=2
|
| 22 |
+
|
| 23 |
+
# ==============================================================
|
| 24 |
+
# 3. HUGGING FACE SECURITY/PERMISSION REQUIREMENTS
|
| 25 |
+
# ==============================================================
|
| 26 |
+
# Hugging Face forces Docker containers to run as a non-root user (UID 1000).
|
| 27 |
+
# We must take ownership of the application and data directories so OpenWebUI
|
| 28 |
+
# can successfully write its configuration and local database files.
|
| 29 |
+
RUN chown -R 1000:1000 /app/backend
|
| 30 |
+
|
| 31 |
+
# Redirect the home directory and cache to the writable data folder
|
| 32 |
+
# This ensures background models (like RAG embeddings) don't crash due to permissions
|
| 33 |
+
ENV HOME=/app/backend/data
|
| 34 |
+
ENV HF_HOME=/app/backend/data/cache
|
| 35 |
+
|
| 36 |
+
# Switch to the mandated Hugging Face user ID
|
| 37 |
+
USER 1000
|