# Specify the base Docker image FROM ollama/ollama:latest # Install Python 3 and its package manager RUN apt-get update && apt-get install -y python3 python3-pip # Create the user's home directory RUN useradd -ms /bin/bash user # Set the home directory ENV HOME=/home/user WORKDIR $HOME # Switch to the non-root user USER user # Copy the entrypoint script before switching users # COPY entrypoint.sh /usr/local/bin/entrypoint.sh COPY requirements.txt $HOME/requirements.txt COPY entrypoint.sh $HOME/entrypoint.sh # Ensure the user has access to the directory RUN mkdir -p $HOME/.ollama && chown -R user:user $HOME/.ollama # Install netcat (nc) for checking server readiness # RUN apt-get update && apt-get install -y netcat RUN pip3 install -r requirements.txt ENTRYPOINT ["$HOME/entrypoint.sh"] # Set permissions for the entrypoint script RUN chmod +x $HOME/entrypoint.sh COPY profile.png $HOME/profile.png