stt-gpu-service-python-v4 / Dockerfile_fixed
Peter Michael Gits
Fix Dockerfile directory permissions - create /app as root before switching users
26096f4
raw
history blame contribute delete
956 Bytes
FROM python:3.10-slim
# Set environment variables
ENV PYTHONUNBUFFERED=1
ENV TRANSFORMERS_CACHE=/app/model_cache
ENV HF_HOME=/app/model_cache
# Install system dependencies
RUN apt-get update && apt-get install -y \
ffmpeg \
libsndfile1 \
git \
curl \
gcc \
g++ \
&& rm -rf /var/lib/apt/lists/*
# Create app directory and model cache directory
WORKDIR /app
RUN mkdir -p /app/model_cache
# Copy requirements first for better Docker layer caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir --upgrade pip
RUN pip install --no-cache-dir -r requirements.txt
# Copy application files
COPY app.py .
# Set permissions for model cache
RUN chmod -R 755 /app/model_cache
# Expose port
EXPOSE 7860
# Health check
HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
# Run the application
CMD ["python", "app.py"]