Spaces:
Running
Running
# Use the Ubuntu image. | |
FROM python:3.11-slim-buster | |
# Allow statements and log messages to immediately appear in the logs | |
ENV PYTHONUNBUFFERED True | |
# Copy local code to the container image. | |
WORKDIR /code | |
COPY . /code/ | |
# Delete the numpy package from cache | |
RUN rm -rf /root/.cache/pip | |
# Install system dependencies for pyworld | |
RUN apt-get update && \ | |
apt-get install -y && \ | |
apt-get -y update &&\ | |
apt-get install -y python3-pip python3-dev python3-opencv && \ | |
rm -rf /var/lib/apt/lists/* | |
# Add write user | |
RUN useradd -m -u 1000 user | |
USER user | |
ENV HOME=/home/user \ | |
PATH=/home/user/.local/bin:$PATH | |
WORKDIR $HOME/app | |
COPY --chown=user . $HOME/app | |
# Install production dependencies. | |
RUN pip install --no-cache-dir -r /code/requirements.txt | |
# Expose the app port | |
EXPOSE 7860 | |
# Run the FastAPI application using Uvicorn server. | |
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |