|
1 |
| -# ---------- Stage 1: Build CSS with Node ------------------------- |
2 |
| -FROM node:20-alpine AS css-builder |
3 |
| -WORKDIR /frontend |
4 |
| - |
5 |
| -# Copy only files that affect the CSS build to leverage Docker cache |
6 |
| -COPY package*.json ./ |
7 |
| -RUN npm ci |
8 |
| - |
9 |
| -# Tailwind source --> final CSS |
10 |
| -# (adjust the paths if you store Tailwind input elsewhere) |
11 |
| -COPY tailwind.config.js ./ # Tailwind config |
12 |
| -COPY src/static/css/ ./src/static/css/ # Tailwind input file(s) |
13 |
| -RUN npm run build:css # writes ./src/static/css/site.css |
14 |
| - |
15 |
| - |
16 |
| -# ---------- Stage 2: Install Python dependencies ----------------- |
17 |
| -FROM python:3.12-slim AS python-builder |
| 1 | +# Stage 1: Install Python dependencies |
| 2 | +FROM python:3.13-slim AS python-builder |
18 | 3 | WORKDIR /build
|
19 | 4 |
|
20 |
| -# System build tools first (so later layers are cached if unchanged) |
| 5 | +# System build tools |
21 | 6 | RUN apt-get update \
|
22 | 7 | && apt-get install -y --no-install-recommends gcc python3-dev \
|
23 | 8 | && rm -rf /var/lib/apt/lists/*
|
24 | 9 |
|
25 |
| -# Python dependencies |
| 10 | +# Metadata and code that setuptools needs |
26 | 11 | COPY pyproject.toml .
|
| 12 | +COPY src/ ./src/ |
| 13 | + |
| 14 | + |
| 15 | +# Install runtime dependencies defined in pyproject.toml |
27 | 16 | RUN pip install --no-cache-dir --upgrade pip \
|
28 |
| - && pip install --no-cache-dir --timeout 1000 "." |
| 17 | + && pip install --no-cache-dir --timeout 1000 . |
29 | 18 |
|
30 | 19 |
|
31 |
| -# ---------- Stage 3: Final runtime image ------------------------- |
32 |
| -FROM python:3.12-slim |
| 20 | +# Stage 2: Runtime image |
| 21 | +FROM python:3.13-slim |
33 | 22 | LABEL org.opencontainers.image.source="https://github.com/cyclotruc/gitingest"
|
34 | 23 |
|
35 | 24 | # Minimal runtime utilities
|
36 | 25 | RUN apt-get update \
|
37 | 26 | && apt-get install -y --no-install-recommends git curl \
|
| 27 | + && apt-get clean \ |
38 | 28 | && rm -rf /var/lib/apt/lists/*
|
39 | 29 |
|
40 |
| -ENV PYTHONUNBUFFERED=1 \ |
41 |
| - PYTHONDONTWRITEBYTECODE=1 |
42 |
| - |
| 30 | +ENV PYTHONUNBUFFERED=1 PYTHONDONTWRITEBYTECODE=1 |
43 | 31 | WORKDIR /app
|
44 |
| - |
45 |
| -# Create non-root user (uid 1000 == common default on Linux host) |
46 | 32 | RUN useradd -m -u 1000 appuser
|
47 | 33 |
|
48 |
| -# ── Copy Python site-packages & app code ─────────────────────────── |
49 |
| -COPY --from=python-builder /usr/local/lib/python3.12/site-packages/ \ |
50 |
| - /usr/local/lib/python3.12/site-packages/ |
51 |
| -COPY src/ ./ |
52 |
| - |
53 |
| -# ── Copy the freshly-built CSS ──────────────────────────────────── |
54 |
| -COPY --from=css-builder /frontend/src/static/css/site.css \ |
55 |
| - src/static/css/site.css |
| 34 | +# Copy Python site-packages and code |
| 35 | +COPY --from=python-builder /usr/local/lib/python3.13/site-packages/ \ |
| 36 | + /usr/local/lib/python3.13/site-packages/ |
| 37 | +COPY src/ ./src/ |
56 | 38 |
|
57 |
| -# Fix permissions |
| 39 | +# Set permissions |
58 | 40 | RUN chown -R appuser:appuser /app
|
59 | 41 | USER appuser
|
60 | 42 |
|
|
0 commit comments