PAN-SEA / Dockerfile
taspol's picture
fix: Restqdrant
8345624
FROM python:3.11-slim
# Set working directory
WORKDIR /app
# Set environment variables
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1
ENV PYTHONPATH=/app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
&& rm -rf /var/lib/apt/lists/*
# Copy requirements first for better caching
COPY requirements.txt .
# Install Python dependencies with careful version management
RUN pip install --no-cache-dir --upgrade pip==23.3.1 && \
pip install --no-cache-dir wheel setuptools && \
pip install --no-cache-dir torch==2.1.1 torchvision==0.16.1 torchaudio==2.1.1 --index-url https://download.pytorch.org/whl/cpu && \
pip install --no-cache-dir numpy==1.24.3 && \
pip install --no-cache-dir tokenizers==0.15.0 && \
pip install --no-cache-dir huggingface-hub==0.17.3 && \
pip install --no-cache-dir transformers==4.35.2 && \
pip install --no-cache-dir sentence-transformers==2.2.2 && \
pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY . .
# Create necessary directories
RUN mkdir -p /app/data /app/logs
# Create non-root user
RUN useradd --create-home --shell /bin/bash app && \
chown -R app:app /app
USER app
# Expose port
EXPOSE 8000
# # Health check
# HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
# CMD curl -f http://localhost:8000/v1 || exit 1
# Run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860", "--timeout-keep-alive", "0"]