Spaces:
Running
Running
Naimul Islam Nahid commited on
Create Dockerfile
Browse files- Dockerfile +32 -0
Dockerfile
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official OpenWebUI image
|
| 2 |
+
FROM ghcr.io/open-webui/open-webui:main
|
| 3 |
+
|
| 4 |
+
# Hugging Face Spaces run as non-root user 1000.
|
| 5 |
+
# We must switch to root temporarily to ensure permissions are correct.
|
| 6 |
+
USER root
|
| 7 |
+
RUN mkdir -p /app/backend/data && chown -R 1000:1000 /app
|
| 8 |
+
|
| 9 |
+
# Switch back to the required Hugging Face user
|
| 10 |
+
USER 1000
|
| 11 |
+
|
| 12 |
+
# Set networking environment variables for Hugging Face
|
| 13 |
+
ENV PORT=7860
|
| 14 |
+
ENV HOST=0.0.0.0
|
| 15 |
+
|
| 16 |
+
# Point the data directory to the Storage Bucket mount path
|
| 17 |
+
ENV DATA_DIR=/app/backend/data
|
| 18 |
+
|
| 19 |
+
# -----------------------------------------------------------------
|
| 20 |
+
# RESOURCE LIMITATION (Max 95% usage to prevent overloading)
|
| 21 |
+
# -----------------------------------------------------------------
|
| 22 |
+
# The free tier has 2 vCPUs and 16GB RAM. OpenWebUI is naturally lightweight
|
| 23 |
+
# (using ~1GB RAM). By strictly limiting the workers and memory arena,
|
| 24 |
+
# we ensure the container never spikes above the 15.2GB (95%) danger zone.
|
| 25 |
+
ENV WEBUI_WORKERS=1
|
| 26 |
+
ENV MALLOC_ARENA_MAX=2
|
| 27 |
+
|
| 28 |
+
# Expose the required port
|
| 29 |
+
EXPOSE 7860
|
| 30 |
+
|
| 31 |
+
# Start the application
|
| 32 |
+
CMD ["bash", "start.sh"]
|