quality-lens / Dockerfile
Tristan Yu
Upload 2 files
6cded78 verified
FROM python:3.10-slim
# Install system dependencies
RUN apt-get update && \
apt-get install -y --no-install-recommends \
build-essential \
git \
sox \
libsox-dev \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# Create a non-root user
RUN useradd -m -u 1000 user
USER user
ENV HOME=/home/user \
PATH=/home/user/.local/bin:$PATH \
PYTHONUNBUFFERED=1 \
TOKENIZERS_PARALLELISM=false \
FAIRSEQ2_EXTENSION_TRACE=1
WORKDIR $HOME/app
# Copy requirements first
COPY --chown=user requirements.txt .
# Install Python packages in the correct order
RUN pip install --no-cache-dir --upgrade pip && \
pip install --no-cache-dir typing-extensions>=4.0.0 && \
pip install --no-cache-dir numpy>=1.20.0 && \
pip install --no-cache-dir -r requirements.txt
# Copy the rest of the application
COPY --chown=user . .
# Set environment variables
ENV HF_TOKEN=$HF_TOKEN
ENV PORT=7860
# Make port 7860 available (Hugging Face Spaces default)
EXPOSE 7860
# Command to run the application
CMD ["python", "app.py"]