Spaces:
Build error
Build error
# Use official Python base image | |
FROM python:3.12.5 | |
# 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 | |
# Install Ollama | |
RUN curl -fsSL https://ollama.com/install.sh | sh | |
# Pull the Llama3 model (or any other model you need) | |
RUN ollama pull llama3:8b | |
# Copy application code | |
COPY --chown=user . /app | |
# Expose FastAPI default port | |
EXPOSE 7860 | |
# Run the FastAPI app | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |