Skip to content

Commit 46f2208

Browse files
fix: build docker image with older webview support
1 parent 85109cf commit 46f2208

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
node_modules/
2+
dist/
23
.env
34
data/
45
temp/

Dockerfile

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
# ── Build stage ───────────────────────────────────────────────────────────────
2-
FROM node:18-alpine AS deps
2+
# Installs all deps (including devDeps for esbuild), transpiles public/ → dist/
3+
# for Chrome 69 / older Android WebView, then prunes devDeps before handoff.
4+
FROM node:18-alpine AS build
35

46
WORKDIR /app
57

68
# python3/make/g++ are required to compile the native bcrypt addon
79
RUN apk add --no-cache python3 make g++
810

911
COPY package*.json ./
10-
RUN npm ci --omit=dev
12+
RUN npm ci
13+
14+
COPY . .
15+
RUN npm run build
16+
RUN npm prune --omit=dev
1117

1218
# ── Runtime stage ─────────────────────────────────────────────────────────────
1319
FROM node:18-alpine
@@ -18,8 +24,10 @@ WORKDIR /app
1824
RUN addgroup -S codexa && adduser -S codexa -G codexa && \
1925
apk add --no-cache su-exec
2026

21-
# Copy deps and source
22-
COPY --from=deps /app/node_modules ./node_modules
27+
# Production node_modules (devDeps already pruned) + transpiled dist/
28+
COPY --from=build /app/node_modules ./node_modules
29+
COPY --from=build /app/dist ./dist
30+
# Source files (public/ kept as server-side fallback; dist/ wins at runtime)
2331
COPY . .
2432

2533
# Data directory — mount a named volume here for persistence

0 commit comments

Comments
 (0)