Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +16 -0
Dockerfile
CHANGED
|
@@ -8,6 +8,15 @@ RUN apt-get update && apt-get install -y \
|
|
| 8 |
libsndfile1 \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 11 |
# Copy requirements first for better caching
|
| 12 |
COPY requirements.txt .
|
| 13 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
@@ -20,6 +29,13 @@ ENV PORT=7860
|
|
| 20 |
ENV MODEL_NAME="jonatasgrosman/wav2vec2-large-xlsr-53-arabic"
|
| 21 |
# HF_TOKEN will be set at runtime
|
| 22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
# Expose port
|
| 24 |
EXPOSE 7860
|
| 25 |
|
|
|
|
| 8 |
libsndfile1 \
|
| 9 |
&& rm -rf /var/lib/apt/lists/*
|
| 10 |
|
| 11 |
+
# Create cache directories with proper permissions
|
| 12 |
+
RUN mkdir -p /cache/huggingface /cache/numba \
|
| 13 |
+
&& chmod -R 777 /cache
|
| 14 |
+
|
| 15 |
+
# Set environment variables for caching
|
| 16 |
+
ENV TRANSFORMERS_CACHE=/cache/huggingface
|
| 17 |
+
ENV NUMBA_CACHE_DIR=/cache/numba
|
| 18 |
+
ENV NUMBA_DISABLE_JIT=1
|
| 19 |
+
|
| 20 |
# Copy requirements first for better caching
|
| 21 |
COPY requirements.txt .
|
| 22 |
RUN pip install --no-cache-dir -r requirements.txt
|
|
|
|
| 29 |
ENV MODEL_NAME="jonatasgrosman/wav2vec2-large-xlsr-53-arabic"
|
| 30 |
# HF_TOKEN will be set at runtime
|
| 31 |
|
| 32 |
+
# Make sure the work directory is accessible
|
| 33 |
+
RUN chmod -R 777 /app
|
| 34 |
+
|
| 35 |
+
# Run as non-root user for better security
|
| 36 |
+
RUN useradd -m appuser
|
| 37 |
+
USER appuser
|
| 38 |
+
|
| 39 |
# Expose port
|
| 40 |
EXPOSE 7860
|
| 41 |
|