OpenWebUI / Dockerfile
thejagstudio's picture
Update Dockerfile
b52bd15 verified
# ---------------------------------------------------------
# 1️⃣ Use the official OpenWebUI image (latest tag)
# ---------------------------------------------------------
FROM ghcr.io/open-webui/open-webui:main
# ---------------------------------------------------------
# 2️⃣ Set Environment Variables
# ---------------------------------------------------------
ENV ENABLE_OPENAI_API=true
ENV DISABLE_EMBEDDINGS=false
# Explicitly set the data directory to a path we control
ENV DATA_DIR=/app/backend/data
# ---------------------------------------------------------
# 3️⃣ Fix Permissions for Hugging Face Spaces
# ---------------------------------------------------------
# HF Spaces run as user 1000. We must ensure this user has read/write
# access to the data directory where the SQLite DB is created.
USER root
RUN mkdir -p $DATA_DIR && \
chown -R 1000:1000 /app && \
chmod -R 777 $DATA_DIR
USER 1000
# ---------------------------------------------------------
# 4️⃣ Expose port
# ---------------------------------------------------------
# Open WebUI defaults to 8080. If HF Spaces expects 7860,
# you MUST tell Open WebUI to run on 7860 using the PORT env var.
ENV PORT=7860
EXPOSE 7860