File size: 1,174 Bytes
3b2ed3e 40d20a3 ea3994a 40d20a3 3b2ed3e 4a7287f ea3994a 3b2ed3e 40d20a3 3b2ed3e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# Define the base image
FROM python:3.9
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH="/home/user/.local/bin:$PATH"
# Create app directory
WORKDIR $HOME/app
# Try and run pip command after setting the user with `USER user` to avoid permission issues with Python
RUN pip install --no-cache-dir --upgrade pip
# Copy the current directory contents into the container at $HOME/app setting the owner to the user
COPY --chown=user . $HOME/app
# Set environment variables
ENV EMBED_DEVICE_CHOICE="cpu" \
PYTHONUNBUFFERED=1
# Install system dependencies
RUN apt-get update && \
apt-get install -y curl
# apt-get clean && rm -rf /var/lib/apt/lists/*
# Install Ollama
RUN curl -fsSL https://ollama.com/install.sh | sh
# Install Python dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir -r /app/requirements.txt
# Expose port for the Gradio app
EXPOSE 7860
ENV GRADIO_SERVER_NAME="0.0.0.0"
# Pull the Llama model using Ollama
RUN ollama serve & sleep 10 && ollama run wangshenzhi/llama3-8b-chinese-chat-ollama-q4
# Start the Ollama server and the app
CMD ollama serve & python chatbot_app.py |