# Use an official Python runtime as a parent image | |
FROM python:3.9-slim | |
# Set environment variables | |
ENV PYTHONDONTWRITEBYTECODE 1 | |
ENV PYTHONUNBUFFERED 1 | |
WORKDIR /code | |
ENV HF_HOME=/code/huggingface_cache | |
RUN mkdir -p $HF_HOME && \ | |
chmod -R 777 $HF_HOME | |
# Install Python dependencies | |
COPY requirements.txt . | |
RUN pip install --no-cache-dir --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt | |
# Copy the rest of the application code into the container | |
COPY ./app /code/app | |
COPY ./static /code/static | |
COPY ./index.html /code/index.html | |
EXPOSE 7860 | |
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"] |