echofocus / Dockerfile
rjattt's picture
Upload Dockerfile with huggingface_hub
4fa4e7d verified
Raw History Blame Contribute Delete
990 Bytes
FROM python:3.11-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
libsndfile1 \
ffmpeg \
git \
&& rm -rf /var/lib/apt/lists/*
# Hugging Face Spaces & standard non-root container user (UID 1000)
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PORT=7860 \
OMP_NUM_THREADS=2 \
MKL_NUM_THREADS=2 \
OPENBLAS_NUM_THREADS=2
WORKDIR $HOME/app
# Upgrade pip and install CPU torch wheels
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir \
--index-url https://download.pytorch.org/whl/cpu \
torch torchaudio
COPY --chown=user:user requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY --chown=user:user . .
# Download trained checkpoints during build so container starts instantly
RUN python scripts/download_weights.py
EXPOSE 7860
CMD ["sh", "-c", "python server.py --host 0.0.0.0 --port ${PORT:-7860}"]