File tree Expand file tree Collapse file tree 1 file changed +49
-0
lines changed
Expand file tree Collapse file tree 1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change 1+ FROM node:18-bookworm AS frontend-base
2+
3+ # Install dependencies only when needed
4+ FROM frontend-base AS deps
5+ WORKDIR /app
6+
7+ # Copy package files
8+ COPY frontend/package*.json ./
9+ RUN npm ci
10+
11+ # Rebuild the source code only when needed
12+ FROM frontend-base AS frontend-builder
13+ WORKDIR /app
14+ COPY --from=deps /app/node_modules ./node_modules
15+ COPY ./frontend/ .
16+
17+ # Build the application
18+ RUN npm run build
19+
20+
21+ FROM python:3.13-slim-bookworm
22+
23+ WORKDIR /app
24+
25+ # Install system dependencies including PostgreSQL client libraries
26+ RUN apt-get update && apt-get install -y \
27+ build-essential \
28+ libpq-dev \
29+ curl \
30+ nodejs \
31+ socat \
32+ && rm -rf /var/lib/apt/lists/*
33+
34+ # Copy requirements first to leverage Docker layer caching
35+ COPY backend/requirements.txt .
36+
37+ # Install PostgreSQL adapter
38+ RUN pip install --no-cache-dir asyncpg psycopg2-binary
39+
40+ # Install Python dependencies
41+ RUN pip install --no-cache-dir -r requirements.txt
42+
43+ # Copy the backend source code
44+ COPY ./backend/ .
45+
46+
47+ # Copy the nextjs application
48+ COPY --from=frontend-builder --chown=nobody /app/.next/standalone ./
49+ COPY --from=frontend-builder --chown=nobody /app/.next/static ./.next/static
You can’t perform that action at this time.
0 commit comments