# read the doc: https://huggingface.co/docs/hub/spaces-sdks-docker # you will also find guides on how best to write your Dockerfile # FROM python:3.11-trixie # # The two following lines are requirements for the Dev Mode to be functional # # Learn more about the Dev Mode at https://huggingface.co/dev-mode-explorers # RUN useradd -m -u 1000 user # WORKDIR /app # COPY --chown=user ./requirements.txt requirements.txt # RUN pip install --no-cache-dir --upgrade -r requirements.txt # COPY --chown=user . /app # CMD ["bash", "run.sh"] FROM ghcr.io/open-webui/open-webui:main # Set up a new user named "user" with user ID 1000 (Hugging Face requirement) RUN useradd -m -u 1000 user RUN chown -R user:user /app RUN mkdir /data RUN chown -R user:user /data # Switch to the "user" user USER user # Set environment variables for Hugging Face Spaces ENV PORT=7860 ENV HOST=0.0.0.0 # Disable Ollama, ensure OpenAI API is enabled ENV ENABLE_OLLAMA_API=false ENV ENABLE_OPENAI_API=true ENV DATA_DIR=/data # Temporary workaround until we figure out how this works # ENV WEBUI_SECRET_KEY="t0p-s3cr3t" # FROM python:3.11-slim-trixie # WORKDIR /app # USER root # # RUN apk add --update --no-cache build-base rust cargo # RUN apt update # RUN apt install -y build-essential rustc cargo wget # RUN pip install --upgrade pip setuptools # # COPY requirements.txt . # # RUN pip install -r requirements.txt # # RUN apt update # # RUN apt install -y wget # COPY run.sh . # RUN chmod +x run.sh # USER pn # ENV HOME=/home/pn \ # PATH=/home/pn/.local/bin:$PATH # RUN mkdir $HOME/app # WORKDIR $HOME/app # COPY --chown=pn requirements.txt requirements.txt # RUN pip install --no-cache-dir -r requirements.txt # # Copy nginx configuration # # COPY --chown=pn nginx.conf /etc/nginx/sites-available/default # COPY --chown=pn . . # EXPOSE 8080 # CMD ["bash", "run.sh"]