Chittrarasu's picture
deploy
6fb7326
raw
history blame
880 Bytes
# Use an official Python image
FROM python:3.9
# Set environment variables for cache location
ENV HF_HOME="/app/cache"
ENV TRANSFORMERS_CACHE="/app/cache"
# Create the cache directory and set permissions
RUN mkdir -p /app/cache && chmod -R 777 /app/cache
# Install required Python packages
RUN pip install --no-cache-dir uvicorn fastapi sentence-transformers
# Pre-download the model and set proper permissions
RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/clip-ViT-B-32-multilingual-v1')" && chmod -R 777 /app/cache
# Set working directory
WORKDIR /app
# Copy application code
COPY . /app
# Ensure the app runs with correct permissions
RUN chmod -R 777 /app
# Expose port for FastAPI
EXPOSE 7860
# Start the FastAPI app
CMD ["python", "-m", "uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]