Vestiq / DockerFile
Hashii1729's picture
Add initial project structure with Docker, FastAPI, and Ollama integration
d2ba52b
raw
history blame
915 Bytes
FROM ollama/ollama:0.9.2
# Install Python and dependencies with security updates
RUN apt-get update && apt-get install -y \
python3 \
python3-pip \
curl \
&& apt-get upgrade -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
# Create non-root user for security
RUN groupadd -r appuser && useradd -r -g appuser appuser
# Set working directory
WORKDIR /app
# Copy requirements and install Python packages
COPY requirements.txt .
RUN pip3 install --no-cache-dir -r requirements.txt
# Copy your FastAPI app
COPY fast.py .
COPY start.sh .
RUN chmod +x start.sh
# Change ownership to non-root user
RUN chown -R appuser:appuser /app
# Set environment variables
ENV OLLAMA_HOST=0.0.0.0:11434
ENV OLLAMA_ORIGINS=*
# Expose ports
EXPOSE 7860
EXPOSE 11434
# Switch to non-root user
USER appuser
# Start both Ollama and FastAPI
ENTRYPOINT []
CMD ["bash", "/app/start.sh"]