fix(docker): upgrade Dockerfiles to node:22-slim + add NODE_TLS + fix next.config.ts
- backend/Dockerfile: alpine→slim, add NODE_TLS_REJECT_UNAUTHORIZED=0, 3-stage pattern - web/Dockerfile: alpine→slim, add NODE_TLS_REJECT_UNAUTHORIZED=0, remove non-existent public/ COPY - web/next.config.ts: add transpilePackages + webpack symlinks for pnpm @bytelyst/* resolution Docker smoke tests: backend + web builds pass
This commit is contained in:
parent
008554cd8d
commit
cbbd9ddce9
@ -1,7 +1,8 @@
|
|||||||
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
|
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
|
||||||
# ── Stage 1: Build ────────────────────────────────────
|
# ── Stage 1: Build ────────────────────────────────────
|
||||||
FROM node:22-alpine AS builder
|
FROM node:22-slim AS builder
|
||||||
WORKDIR /app/backend
|
WORKDIR /app/backend
|
||||||
|
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
|
|
||||||
RUN npm config set strict-ssl false
|
RUN npm config set strict-ssl false
|
||||||
COPY backend/package.json ./package.json
|
COPY backend/package.json ./package.json
|
||||||
@ -14,18 +15,25 @@ COPY shared/ ./shared/
|
|||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# ── Stage 2: Runtime ──────────────────────────────────
|
# ── Stage 2: Runtime ──────────────────────────────────
|
||||||
FROM node:22-alpine
|
FROM node:22-slim AS deps
|
||||||
WORKDIR /app/backend
|
WORKDIR /app/backend
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
|
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
|
|
||||||
RUN npm config set strict-ssl false
|
RUN npm config set strict-ssl false
|
||||||
COPY backend/package.json ./package.json
|
COPY backend/package.json ./package.json
|
||||||
COPY backend/.docker-deps/ ./.docker-deps/
|
COPY backend/.docker-deps/ ./.docker-deps/
|
||||||
RUN npm install --omit=dev --ignore-scripts
|
RUN npm install --omit=dev --ignore-scripts
|
||||||
|
|
||||||
|
# ── Stage 3: Runtime ──────────────────────────────────
|
||||||
|
FROM node:22-slim
|
||||||
|
WORKDIR /app/backend
|
||||||
|
ENV NODE_ENV=production
|
||||||
|
|
||||||
|
COPY --from=deps /app/backend/node_modules ./node_modules
|
||||||
|
COPY --from=deps /app/backend/package.json ./package.json
|
||||||
COPY --from=builder /app/backend/dist ./dist
|
COPY --from=builder /app/backend/dist ./dist
|
||||||
COPY --from=builder /app/backend/shared ./shared
|
COPY shared/product.json ../shared/product.json
|
||||||
|
|
||||||
EXPOSE 4016
|
EXPOSE 4016
|
||||||
|
|
||||||
CMD ["node", "dist/server.js"]
|
CMD ["node", "dist/server.js"]
|
||||||
|
|||||||
@ -1,7 +1,8 @@
|
|||||||
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
|
# Pre-requisite: run ./scripts/docker-prep.sh to pack @bytelyst/* tarballs
|
||||||
# ── Stage 1: Install ──────────────────────────────────
|
# ── Stage 1: Install ──────────────────────────────────
|
||||||
FROM node:22-alpine AS builder
|
FROM node:22-slim AS builder
|
||||||
WORKDIR /app/web
|
WORKDIR /app/web
|
||||||
|
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
RUN npm config set strict-ssl false
|
RUN npm config set strict-ssl false
|
||||||
COPY web/package.json ./package.json
|
COPY web/package.json ./package.json
|
||||||
COPY web/.docker-deps/ ./.docker-deps/
|
COPY web/.docker-deps/ ./.docker-deps/
|
||||||
@ -14,11 +15,12 @@ COPY shared/ ../shared/
|
|||||||
ENV NEXT_PUBLIC_BACKEND_URL=http://localhost:4016
|
ENV NEXT_PUBLIC_BACKEND_URL=http://localhost:4016
|
||||||
ENV NEXT_PUBLIC_PLATFORM_URL=http://localhost:4003
|
ENV NEXT_PUBLIC_PLATFORM_URL=http://localhost:4003
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
|
ENV NODE_TLS_REJECT_UNAUTHORIZED=0
|
||||||
|
|
||||||
RUN npm run build
|
RUN npm run build
|
||||||
|
|
||||||
# ── Stage 3: Runtime ──────────────────────────────────
|
# ── Stage 2: Runtime ──────────────────────────────────
|
||||||
FROM node:22-alpine AS runtime
|
FROM node:22-slim
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NEXT_TELEMETRY_DISABLED=1
|
ENV NEXT_TELEMETRY_DISABLED=1
|
||||||
@ -27,5 +29,4 @@ COPY --from=builder /app/web/.next/standalone ./
|
|||||||
COPY --from=builder /app/web/.next/static ./.next/static
|
COPY --from=builder /app/web/.next/static ./.next/static
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
||||||
CMD ["node", "server.js"]
|
CMD ["node", "server.js"]
|
||||||
|
|||||||
@ -23,6 +23,21 @@ const securityHeaders = [
|
|||||||
const nextConfig: NextConfig = {
|
const nextConfig: NextConfig = {
|
||||||
output: "standalone",
|
output: "standalone",
|
||||||
outputFileTracingRoot: path.join(process.cwd(), ".."),
|
outputFileTracingRoot: path.join(process.cwd(), ".."),
|
||||||
|
transpilePackages: [
|
||||||
|
"@bytelyst/api-client",
|
||||||
|
"@bytelyst/blob-client",
|
||||||
|
"@bytelyst/design-tokens",
|
||||||
|
"@bytelyst/diagnostics-client",
|
||||||
|
"@bytelyst/feature-flag-client",
|
||||||
|
"@bytelyst/kill-switch-client",
|
||||||
|
"@bytelyst/platform-client",
|
||||||
|
"@bytelyst/react-auth",
|
||||||
|
"@bytelyst/telemetry-client",
|
||||||
|
],
|
||||||
|
webpack: (config) => {
|
||||||
|
config.resolve.symlinks = true;
|
||||||
|
return config;
|
||||||
|
},
|
||||||
async headers() {
|
async headers() {
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user