File size: 659 Bytes
f5a7a9e f7f4d0f f5a7a9e c1568d0 f5a7a9e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
FROM python:3.9-slim
WORKDIR /code
# Create cache directory with proper permissions
RUN mkdir -p /cache
ENV TRANSFORMERS_CACHE=/cache
ENV HF_HOME=/cache
RUN chmod 777 /cache
COPY ./requirements.txt /code/requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
COPY . /code
# Make directory for uploads
RUN mkdir -p /code/uploads
RUN chmod 777 /code/uploads
# Expose the port
EXPOSE 7860
# Add a health check to ensure the server is running
HEALTHCHECK --interval=30s --timeout=30s --start-period=5s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Command to run the application
CMD ["python", "app.py"] |