FROM python:3.9 | |
# Install system dependencies as root | |
RUN apt-get update && \ | |
apt-get install -y git curl && \ | |
apt-get clean && \ | |
rm -rf /var/lib/apt/lists/* | |
# Install Ollama | |
RUN curl -fsSL https://ollama.com/install.sh | sh | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV PATH="/home/user/.local/bin:$PATH" | |
WORKDIR /app | |
COPY --chown=user ./requirements.txt requirements.txt | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Copy the application code and startup script | |
COPY --chown=user . /app | |
COPY --chown=user ./startup.sh /app/startup.sh | |
RUN chmod +x /app/startup.sh | |
CMD ["/app/startup.sh"] |