pixelperfect / Dockerfile
earncoding's picture
Update Dockerfile
8a988e5 verified
Raw History Blame Contribute Delete
911 Bytes
# Use an official Python runtime as a parent image
FROM python:3.9-slim
# Set the working directory in the container
WORKDIR /code
# --- FIX FOR NUMBA CACHING ---
# Point the cache to the universally writable /tmp directory.
ENV NUMBA_CACHE_DIR /tmp/numba_cache
# --- FIX FOR REMBG MODEL CACHING ---
# Point the model cache to the universally writable /tmp directory as well.
# This solves all permission issues because any user can write to /tmp.
ENV U2NET_HOME /tmp/u2net_models
# Copy the requirements file into the container at /code
COPY ./app/requirements.txt /code/requirements.txt
# Install any needed packages specified in requirements.txt
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt
# Copy the rest of the application code into the container
COPY ./app /code/app
# The command to run your application
CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]