File size: 1,277 Bytes
92fd1a7
0e21e95
72e8a3d
 
 
 
92fd1a7
72e8a3d
 
 
92fd1a7
0e21e95
92fd1a7
 
 
 
 
 
 
 
0e21e95
 
92fd1a7
 
0e21e95
f1a7e59
92fd1a7
0e21e95
92fd1a7
f1a7e59
0e21e95
92fd1a7
 
 
 
72e8a3d
dbe78dd
 
 
 
 
 
 
 
92fd1a7
 
 
72e8a3d
 
 
 
 
92fd1a7
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
FROM python:3.9-slim

# Install system dependencies including ffmpeg
RUN apt-get update && \
    apt-get install -y \
    ffmpeg \
    curl \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Create user for Hugging Face
RUN useradd -m -u 1000 user

# Set working directory
WORKDIR /app

# Copy requirements first for better caching
COPY --chown=user:user requirements.txt .

# Switch to user and install Python dependencies
USER user
ENV PATH="/home/user/.local/bin:$PATH"
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copy application code
COPY --chown=user:user . .

# Create necessary directories
RUN mkdir -p /tmp/audio_extractor

# Set environment variables
ENV PYTHONPATH=/app
ENV TEMP_DIR=/tmp/audio_extractor
ENV FFMPEG_PATH=/usr/bin/ffmpeg

# Authentication and N8N Configuration
ENV ENFORCE_AUTHENTICATION=true
ENV ENABLE_EXTERNAL_JOB_IDS=true
ENV JWT_VALIDATION_STRICT=false
ENV N8N_BASE_URL=http://localhost:5678
ENV N8N_TOKEN=default-token-change-me
ENV N8N_TIMEOUT=30

# Health check
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
    CMD curl -f http://localhost:7860/api/v1/health || exit 1

# Expose port
EXPOSE 7860

# Run the application
CMD ["python", "main.py"]