File size: 1,106 Bytes
efc4754
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
c021e6f
 
efc4754
 
 
 
 
 
c021e6f
 
efc4754
c021e6f
 
efc4754
d5c7129
c021e6f
efc4754
d5c7129
194097d
efc4754
d5c7129
194097d
efc4754
d5c7129
efc4754
c021e6f
efc4754
d5c7129
 
efc4754
d5c7129
 
efc4754
 
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
54
55
56
57
58
# FROM python:3.9

# WORKDIR /code

# COPY ./requirements.txt /code/requirements.txt

# RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

# RUN useradd -m -u 1000 user

# USER user

# ENV HOME=/home/user \
#  PATH=/home/user/.local/bin:$PATH

# WORKDIR $HOME/app

# COPY --chown=user . $HOME/app

# CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]



FROM python:3.9

# Install ffmpeg
RUN apt-get update && \
    apt-get install -y ffmpeg && \
    rm -rf /var/lib/apt/lists/*

# Set working directory
WORKDIR /code

# Copy requirements file
COPY ./requirements.txt /code/requirements.txt

# Install Python dependencies
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt

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

# Switch to the non-root user
USER user

# Set environment variables
ENV HOME=/home/user \
    PATH=/home/user/.local/bin:$PATH

# Set working directory for the user
WORKDIR $HOME/app

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

# Run the application
CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]