File size: 916 Bytes
699cfd3
9424894
 
 
 
 
 
 
544a3ec
 
 
 
e4767ef
544a3ec
0143a6f
 
 
 
9424894
 
 
544a3ec
 
9424894
e4767ef
 
 
 
544a3ec
e4767ef
0143a6f
699cfd3
544a3ec
0143a6f
544a3ec
e50129b
 
544a3ec
 
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
FROM python:3.10-slim

# Set up a new user named "user" with user ID 1000
RUN useradd -m -u 1000 user

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

# Install build dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    git \
    python3-dev \
    && rm -rf /var/lib/apt/lists/*

# Switch to the "user" user
USER user

# Set the working directory to the user's app directory
WORKDIR $HOME/app

# Copy pyproject.toml first, setting the owner to the user
COPY --chown=user pyproject.toml .

# Upgrade pip and install build tools
RUN pip install --no-cache-dir --upgrade pip setuptools wheel


# Install the project and its dependencies
RUN pip install --no-cache-dir -e . -v

# Copy the rest of the applicati
COPY --chown=user . .

# Expose the port
EXPOSE 7860

# Set the command to run your app
CMD ["python", "app.py", "--server-port", "7860", "--server-address", "0.0.0.0"]