-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdockerfile
More file actions
32 lines (25 loc) · 1.26 KB
/
dockerfile
File metadata and controls
32 lines (25 loc) · 1.26 KB
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
# Use the official Python image from Docker Hub
FROM python:3.8
# Set the working directory to /app
# This creates a consistent and predictable environment for the app
WORKDIR /app
# Copy the current directory contents into the container at /app
# This copies all the files and directories from the local context to the container
COPY . /app
# Copy the requirements.txt file separately from the rest of the app
# This allows Docker to cache the installed packages and speed up the build process
COPY requirements.txt app/requirements.txt
# Upgrade pip to the latest version
RUN pip install --upgrade pip
# Install any needed packages specified in requirements.txt
# The --no-cache-dir flag prevents pip from storing the cache data, which reduces the image size
RUN pip install --no-cache-dir -r app/requirements.txt
# Expose port 8000 for the app
# This tells Docker that the container listens on the specified network port at runtime
EXPOSE 5000
# Define the primary command for the container
# This specifies that python is the executable that will run when the container is launched
ENTRYPOINT ["python"]
# Define the default argument for the primary command
# This specifies that app.py is the script that will be executed by python when the container is launched
CMD ["app.py" ]