open-webui / Dockerfile
vilarin's picture
Update Dockerfile
c9b433a verified
# Deployed Open-webui with persistent admin role with password secret.
# Users registration is allowed by default, but user group data will be lost with each building.
FROM ghcr.io/snekkenull/open-webui:main
WORKDIR /app/backend
RUN mkdir -p /app/backend/open_webui/static
RUN mkdir -p /app/backend/data
RUN mkdir -p /app/cache
# Install necessary dependencies
RUN apt-get update && apt-get install -y apache2-utils sqlite3
# Update the admin password in webui.db by setting secret ORIN_PASSWORD, admin account is vilarin@huggingface.co
COPY webui.db /webui.db
RUN --mount=type=secret,id=ORIN_PASSWORD,mode=0444,required=true \
htpasswd -bnBC 10 "" "$(cat /run/secrets/ORIN_PASSWORD)" | tr -d ':\n' > /tmp/password_hash && \
sqlite3 /webui.db "UPDATE auth SET password='$(cat /tmp/password_hash)' WHERE email='vilarin@huggingface.co';" && \
rm /tmp/password_hash
# Copy the updated webui.db to the desired location
RUN cp /webui.db /app/backend/data/webui.db
# Modify and Copy config.json to set the default lang and preset prompts.
# COPY config.json /app/backend/data/config.json
RUN chmod -R 777 /app/backend/open_webui/static
RUN chmod -R 777 /app/backend/data
RUN chmod -R 777 /app/cache
EXPOSE 7860
CMD ["bash", "start.sh"]