app / Dockerfile
leo861's picture
Upload Dockerfile with huggingface_hub
d1f14b6 verified
FROM python:3.9
# Install system dependencies
RUN apt-get update && apt-get install -y \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
RUN useradd -m -u 1000 user
USER user
ENV PATH="/home/user/.local/bin:$PATH"
WORKDIR /app
# Create cache directory
RUN mkdir -p /home/user/.cache/huggingface/hub
# Copy requirements first to leverage Docker cache
COPY --chown=user requirements.txt requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt
# Copy the rest of the application
COPY --chown=user . /app
# Set environment variables
ENV HF_HOME=/home/user/.cache/huggingface
# Expose the port the app runs on
EXPOSE 7860
# Command to run the application
CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]