Spaces:
Sleeping
Sleeping
FROM python:3.10.8 | |
WORKDIR /app | |
COPY ./app/requirements.txt /app/requirements.txt | |
# Create cache and milvus_data directories and set permissions | |
RUN mkdir -p /app/cache /app/milvus_data && chmod -R 777 /app/cache /app/milvus_data | |
# Install dependencies | |
RUN pip install --no-cache-dir --upgrade -r requirements.txt | |
# Create a non-root user | |
RUN useradd -m -u 1000 user | |
USER user | |
# Set environment variables for Hugging Face cache and Milvus data | |
ENV HF_HOME=/app/cache \ | |
HF_MODULES_CACHE=/app/cache/hf_modules \ | |
MILVUS_DATA_DIR=/app/milvus_data \ | |
HF_WORKER_COUNT=1 | |
# Copy the application code | |
COPY ./app /app | |
# Expose the port Uvicorn will run on | |
EXPOSE 7860 | |
# Start Uvicorn | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] |