File size: 979 Bytes
bed415e
63f90ce
383520d
f08f6c6
 
 
053d168
f08f6c6
bed415e
f08f6c6
 
383520d
63f90ce
 
 
f08f6c6
383520d
 
6692ef0
 
 
 
08dd4fb
96f83bf
c27f115
6692ef0
96f83bf
bed415e
6692ef0
f08f6c6
63f90ce
6692ef0
 
96f83bf
6692ef0
 
383520d
f08f6c6
 
383520d
 
 
 
bed415e
f08f6c6
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
# Use Python 3.10 slim image
FROM python:3.10-slim

# Set environment variables
ENV PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1 \
    PYTHONPATH="/app"

# Set working directory
WORKDIR /app

# Install system dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    netcat-openbsd \
    ffmpeg \
    && rm -rf /var/lib/apt/lists/*

# Create app user first (before creating directories)
RUN useradd -m -u 1000 app

# Create necessary directories and set permissions
RUN mkdir -p /app/storage/audio \
    /app/storage/text \
    /app/storage/temp \
    && chown -R app:app /app

# Copy requirements first to leverage Docker cache
COPY --chown=app:app requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# Copy the entire application code
COPY --chown=app:app . .

# Make scripts executable
RUN chmod +x /app/scripts/*.sh

# Switch to app user
USER app

# Expose port
EXPOSE 7860

# Set entrypoint
ENTRYPOINT ["/app/scripts/run.sh"]