open-webui / Dockerfile
wwforonce's picture
add readeck
940e285
FROM ghcr.io/open-webui/open-webui:main
# Install dependencies
# Install essential build tools and dependencies
RUN apt update && apt install -y \
software-properties-common \
gcc \
curl \
sudo \
git-lfs \
openssl \
wget \
jq \
python3 \
# We will install Node.js and npm using nvm or a direct method, not apt's potentially older versions
&& rm -rf /var/lib/apt/lists/*
# Create a new group (optional, but good practice)
RUN groupadd --system appuser
# Create a new user and add them to the 'appuser' group
# -m: Create the user's home directory
# -s /bin/bash: Set the default shell for the user
# -g appuser: Set the primary group for the user
RUN useradd --system -m -s /bin/bash -g appuser appuser
# Set the working directory to the user's home directory.
# All subsequent commands will operate relative to this directory.
WORKDIR /home/appuser
# Switch to the new user
USER appuser
# Set environment variables for the user (optional)
ENV HOME=/home/appuser
# Install nvm (Node Version Manager) and then use it to install Node.js and npm
# This ensures a clean and controlled Node.js/npm environment
ENV NVM_DIR /home/appuser/.nvm
RUN mkdir -p $NVM_DIR
ENV NODE_VERSION 22
# Specify a compatible Node.js version, matching the earlier error message's requirement
# Optionally, if a specific npm version is absolutely required by the application
# and not provided by the Node.js version installed by nvm:
# If a specific npm version like 11.5.2 was truly needed: npm install -g npm@11.5.2
RUN curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash && \
. "$NVM_DIR/nvm.sh" && \
nvm install $NODE_VERSION && \
nvm use $NODE_VERSION && \
nvm alias default $NODE_VERSION && \
npm install -g npm@latest
# Verify Node.js and npm versions
RUN . "$NVM_DIR/nvm.sh" && node -v && npm -v
# Set all cache directories to /tmp (writable)
ENV HF_HOME=/tmp/hf_cache
ENV HUGGINGFACE_HUB_CACHE=/tmp/hf_cache
ENV TRANSFORMERS_CACHE=/tmp/hf_cache
ENV SENTENCE_TRANSFORMERS_HOME=/tmp/hf_cache
# Override Open WebUI cache directories
ENV DATA_DIR=/tmp/open-webui-data
ENV STATIC_DIR=/tmp/static
# Copy sync scripts
COPY --chown=appuser:appuser ./sync_storage.py ${HOME}/sync_storage.py
COPY --chown=appuser:appuser ./start_with_sync.sh ${HOME}/start_with_sync.sh
# Set working directory
# WORKDIR /app
COPY --chown=appuser:appuser ./add_bash_util.sh ${HOME}/add_bash_util.sh
COPY --chown=appuser:appuser ./Caddyfile ${HOME}/Caddyfile
COPY --chown=appuser:appuser ./crypt.sh ${HOME}/crypt.sh
COPY --chown=appuser:appuser ./gemini ${HOME}/gemini
COPY --chown=appuser:appuser ./readeck.toml ${HOME}/readeck.toml
# Make scripts executable
RUN chmod +x ${HOME}/*.py ${HOME}/*.sh
# Expose ports
EXPOSE 7860
HEALTHCHECK --interval=30s --timeout=10s --start-period=5s \
CMD curl -f http://localhost:7860/ || exit 1
# Start with sync
ENTRYPOINT ["/home/appuser/start_with_sync.sh"]