-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
39 lines (28 loc) · 1.1 KB
/
Dockerfile
File metadata and controls
39 lines (28 loc) · 1.1 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
33
34
35
36
37
38
39
# ---------- Stage 1: Build Layer ----------
FROM python:3.11-slim-bookworm AS builder
WORKDIR /app
# Install build dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Install Python dependencies
COPY requirements.txt .
RUN pip install --upgrade pip \
&& pip install --no-cache-dir --prefix=/install -r requirements.txt
# ---------- Stage 2: Minimal Runtime ----------
FROM python:3.11-slim-bookworm
WORKDIR /app
# Install libpq only for psycopg2 (no compilers needed here)
RUN apt-get update && apt-get install -y --no-install-recommends \
libpq-dev \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy installed dependencies from builder
COPY --from=builder /install /usr/local
# Copy your app code
COPY . .
EXPOSE 8000
# Run the application
CMD ["gunicorn", "be_skillfolio.wsgi:application", "--bind", "0.0.0.0:8000"]