Spaces:
Sleeping
Sleeping
# Use the official Python image from the Docker Hub | |
FROM python:3.9 | |
# Set environment variables | |
ENV TF_ENABLE_ONEDNN_OPTS=0 | |
ENV TRANSFORMERS_CACHE=/code/.cache/huggingface/hub | |
# Set the working directory in the container | |
WORKDIR /code | |
# Create the 'images' directory and make it writable | |
RUN mkdir -p /code/images && \ | |
chmod -R 777 /code/images | |
# Copy the requirements file to the working directory | |
COPY ./requirements.txt /code/requirements.txt | |
# Install the dependencies including tf-keras | |
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt | |
# Copy the rest of the application code to the working directory | |
COPY . . | |
# Ensure the cache directory exists and is writable | |
RUN mkdir -p /code/.cache/huggingface/hub && \ | |
chmod -R 777 /code/.cache/huggingface/hub | |
# Specify the command to run the application | |
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |