recitation-compare / Dockerfile
Hammad712's picture
Update Dockerfile
6954723 verified
raw
history blame
984 Bytes
FROM python:3.9-slim
WORKDIR /app
# Install system dependencies
RUN apt-get update && apt-get install -y \
build-essential \
libsndfile1 \
&& rm -rf /var/lib/apt/lists/*
# Create cache directories with proper permissions
RUN mkdir -p /cache/huggingface /cache/numba \
&& chmod -R 777 /cache
# Set environment variables for caching
ENV TRANSFORMERS_CACHE=/cache/huggingface
ENV NUMBA_CACHE_DIR=/cache/numba
ENV NUMBA_DISABLE_JIT=1
# Copy requirements first for better caching
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
# Copy application code
COPY main.py .
# Set environment variables
ENV PORT=7860
ENV MODEL_NAME="jonatasgrosman/wav2vec2-large-xlsr-53-arabic"
# HF_TOKEN will be set at runtime
# Make sure the work directory is accessible
RUN chmod -R 777 /app
# Run as non-root user for better security
RUN useradd -m appuser
USER appuser
# Expose port
EXPOSE 7860
# Command to run the application
CMD ["python", "main.py"]