File size: 832 Bytes
c966244
a8b5cbf
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58dfeed
 
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
# Use the official Python 3.10 image from the Docker Hub
FROM python:3.10.12

# Create a new user with the username 'user' and a user ID of 1000
RUN useradd -m -u 1000 user

# Switch to the new user
USER user

# Set an environment variable to add the local bin directory to the PATH
ENV PATH="/home/user/.local/bin:$PATH"

# Set the working directory inside the container to /app
WORKDIR /app

# Copy the requirements.txt file into the container, changing ownership to 'user'
COPY --chown=user ./requirements.txt requirements.txt

# Install the dependencies listed in requirements.txt
RUN pip install --no-cache-dir --upgrade -r requirements.txt

# Copy the rest of the application code into the container, changing ownership to 'user'
COPY --chown=user . /app

# Specify the command to run the application
CMD ["python", "app.py"]