Spaces:
Build error
Build error
File size: 693 Bytes
4976e48 6991b93 8429402 4976e48 47aa8e5 8429402 |
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 |
FROM python:3.12.5
# Install Ollama as root
RUN curl -fsSL https://ollama.com/install.sh | sh
# Start Ollama in the background and pull the model
RUN ollama serve & sleep 5 && ollama pull llama3:8b
# Create a new user and switch to it
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
# Set working directory
WORKDIR /app
# Copy and install dependencies
COPY --chown=user ./requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy application code
COPY --chown=user . /app
# Expose FastAPI default port
EXPOSE 7860
# Start Ollama and FastAPI together
CMD ["sh", "-c", "uvicorn app:app --host 0.0.0.0 --port 7860"] |