-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
28 lines (21 loc) · 835 Bytes
/
Dockerfile
File metadata and controls
28 lines (21 loc) · 835 Bytes
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
# Layer 1: Start from a base image
# python:3.11-slim is Debian Linux + Python already installed
# "slim" = minimal size, no extras we don't need
FROM python:3.11-slim
# Layer 2: Set the working directory inside the container
# All following commands run from /app
WORKDIR /app
# Layer 3: Copy ONLY requirements first (for caching - explained below)
COPY app/requirements.txt .
# Layer 4: Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Layer 5: Copy the rest of your application
COPY app/ .
# Layer 6: Copy and make entrypoint executable
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
# Documentation: Tell users this container listens on port 5000
EXPOSE 5000
# ENTRYPOINT runs first, then CMD is passed as arguments to it
ENTRYPOINT ["/entrypoint.sh"]
CMD ["python", "app.py"]