Skip to content

Commit 1cbd2cb

Browse files
authored
Merge pull request #6906 from akatsoulas/fix-pre-render
Add a stage for l10n files
2 parents f0e35c0 + c4a8362 commit 1cbd2cb

File tree

1 file changed

+35
-22
lines changed

1 file changed

+35
-22
lines changed

Dockerfile

Lines changed: 35 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,5 @@
1-
# =========================================
2-
# Stage 1: Build Frontend Assets in Node.js
3-
# =========================================
4-
FROM node:22-bookworm AS frontend-builder
5-
6-
WORKDIR /app
7-
8-
COPY package*.json ./
9-
RUN npm install
10-
11-
COPY . .
12-
RUN cp .env-build .env && \
13-
mkdir -p jsi18n/jsi18n && \
14-
npm run webpack:build:prod && \
15-
npm run webpack:build:pre-render && \
16-
npm run webpack:test
17-
181
# ===================================
19-
# Stage 2: Common Python dependencies
2+
# Stage 1: Common Python dependencies
203
# ===================================
214
FROM python:3.11-bookworm AS python-base
225

@@ -44,7 +27,37 @@ COPY pyproject.toml uv.lock ./
4427
RUN uv venv && uv sync --frozen --extra dev --no-install-project
4528

4629
# =================================
47-
# Stage 3: Development Image Target
30+
# Stage 2: Generate jsi18n files
31+
# =================================
32+
FROM python-base AS jsi18n-generator
33+
34+
COPY . .
35+
RUN uv sync --frozen --extra dev
36+
37+
RUN cp .env-build .env && \
38+
./scripts/l10n-fetch-lint-compile.sh && \
39+
./manage.py compilejsi18n
40+
41+
# ==================================
42+
# Stage 3: Frontend Builder (Node.js)
43+
# ==================================
44+
FROM node:22-bookworm AS frontend-builder
45+
46+
WORKDIR /app
47+
48+
COPY package*.json ./
49+
RUN npm ci
50+
51+
COPY . .
52+
COPY --from=jsi18n-generator /app/jsi18n ./jsi18n
53+
54+
RUN cp .env-build .env && \
55+
npm run webpack:build:prod && \
56+
npm run webpack:build:pre-render && \
57+
npm run webpack:test
58+
59+
# =================================
60+
# Stage 4: Development Image Target
4861
# =================================
4962
FROM python-base AS dev
5063

@@ -53,7 +66,7 @@ COPY . .
5366
RUN uv sync --frozen --extra dev
5467

5568
# =============================
56-
# Stage 4: Testing Image Target
69+
# Stage 5: Testing Image Target
5770
# =============================
5871
FROM python-base AS test
5972

@@ -67,7 +80,7 @@ RUN cp .env-test .env && \
6780
./manage.py collectstatic --noinput
6881

6982
# ======================================
70-
# Stage 5: Build Production Dependencies
83+
# Stage 6: Build Production Dependencies
7184
# ======================================
7285
FROM python-base AS prod-deps
7386

@@ -81,7 +94,7 @@ RUN cp .env-build .env && \
8194
./manage.py collectstatic --noinput
8295

8396
# =====================================
84-
# Stage 5: Final Clean Production Image
97+
# Stage 7: Final Clean Production Image
8598
# =====================================
8699
FROM python:3.11-slim-bookworm AS prod
87100

0 commit comments

Comments
 (0)