fix: revert to node:18 (cached), enable crypto via NODE_OPTIONS

Docker Hub is unreachable from server, so node:20 can't be pulled.
Reverting to node:18-alpine (already cached) and using
--experimental-global-webcrypto to enable globalThis.crypto.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
hailin 2026-02-19 19:17:23 -08:00
parent bbb288025a
commit b620898bc8
2 changed files with 5 additions and 4 deletions

View File

@ -2,7 +2,7 @@
# Usage: docker build --build-arg SERVICE_NAME=auth-service --build-arg SERVICE_PORT=3001 -f Dockerfile.service .
# ===== Build Stage =====
FROM node:20-alpine AS builder
FROM node:18-alpine AS builder
RUN corepack enable
@ -37,7 +37,7 @@ ARG SERVICE_NAME
RUN pnpm turbo build --filter='./packages/shared/*' --filter=@it0/${SERVICE_NAME}
# ===== Production Stage =====
FROM node:20-alpine
FROM node:18-alpine
RUN corepack enable
@ -77,4 +77,5 @@ ARG SERVICE_PORT=3000
EXPOSE ${SERVICE_PORT}
ENV SERVICE_NAME=${SERVICE_NAME}
ENV NODE_OPTIONS="--experimental-global-webcrypto"
CMD node dist/services/${SERVICE_NAME}/src/main

View File

@ -1,5 +1,5 @@
# Next.js standalone production Dockerfile
FROM node:20-alpine AS builder
FROM node:18-alpine AS builder
WORKDIR /app
@ -11,7 +11,7 @@ COPY . .
RUN npm run build
# ===== Production =====
FROM node:20-alpine
FROM node:18-alpine
WORKDIR /app