forked from ChocoMeow/Vocard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
33 lines (24 loc) · 833 Bytes
/
Dockerfile
File metadata and controls
33 lines (24 loc) · 833 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
29
30
31
32
33
# Stage 1: Build
FROM python:3.12-slim-bookworm as builder
# Install build dependencies (gcc, Python headers, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
python3-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Set the working directory
WORKDIR /app
# Copy only the requirements file to take advantage of Docker's caching
COPY requirements.txt .
# Install Python dependencies
RUN pip install --no-cache-dir -r requirements.txt
# Stage 2: Runtime
FROM python:3.12-slim-bookworm
# Set the working directory
WORKDIR /app
# Copy installed Python packages from the builder stage
COPY --from=builder /usr/local/lib/python3.12/site-packages /usr/local/lib/python3.12/site-packages
# Copy the application code
COPY . .
# Run the application
CMD ["python", "-u", "main.py"]