File size: 910 Bytes
993bcf4
 
 
45487a5
993bcf4
45487a5
993bcf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
# Use official Python 3.10 image
FROM python:3.10

# Install ffmpeg, PortAudio (for sounddevice), and other system packages
RUN apt-get update && apt-get install -y \

    ffmpeg \
    portaudio19-dev \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Create a non-root user for security
RUN useradd -m -u 1000 user
USER user

# Add user’s local bin to PATH for pip-installed executables
ENV PATH="/home/user/.local/bin:$PATH"

# Set working directory inside container
WORKDIR /app

# Copy and install Python dependencies as non-root user
COPY --chown=user ./requirements.txt ./requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy application code
COPY --chown=user . /app

# Expose the port your app will run on
EXPOSE 7860

# Start Gunicorn server binding to 0.0.0.0 on port 7860
CMD ["gunicorn", "app:app", "-b", "0.0.0.0:7860"]