From cc1042428fa51d192b6b1a3fc1b7a0698787c4e7 Mon Sep 17 00:00:00 2001 From: Mohamed Habib Date: Wed, 12 Nov 2025 14:41:48 -0800 Subject: [PATCH 1/2] Upgrade Node.js version to 22-alpine in Dockerfile --- Dockerfile_ui | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile_ui b/Dockerfile_ui index 1b1c4bcbe..5548c2a3d 100644 --- a/Dockerfile_ui +++ b/Dockerfile_ui @@ -1,5 +1,5 @@ # Multi-stage build for Taco UI -FROM node:20-alpine AS builder +FROM node:22-alpine AS builder WORKDIR /app @@ -20,7 +20,7 @@ RUN --mount=type=cache,target=/root/.npm \ npm run build # Production stage -FROM node:20-alpine +FROM node:22-alpine WORKDIR /app From 37114d99cf9c7510dc80c35ca98df5a773ae571a Mon Sep 17 00:00:00 2001 From: motatoes Date: Wed, 12 Nov 2025 15:24:10 -0800 Subject: [PATCH 2/2] fix docker cache clean steps --- Dockerfile_ui | 42 ++++++++++++++++++------------------------ 1 file changed, 18 insertions(+), 24 deletions(-) diff --git a/Dockerfile_ui b/Dockerfile_ui index 5548c2a3d..3a94a8643 100644 --- a/Dockerfile_ui +++ b/Dockerfile_ui @@ -1,50 +1,44 @@ -# Multi-stage build for Taco UI +# syntax=docker/dockerfile:1.7 + +########### Builder: compile Vite/TypeScript/etc. ########### FROM node:22-alpine AS builder WORKDIR /app -# Copy package files +# Install ALL dependencies (including devDeps) — required for Vite, tsc, plugins, etc. COPY ui/package.json ui/package-lock.json ./ -# Install dependencies first -# npm will automatically install correct platform-specific binaries (amd64 or arm64) RUN --mount=type=cache,target=/root/.npm \ - npm ci && \ - npm cache clean --force + npm ci -# Copy source code (node_modules excluded via .dockerignore) +# Copy source (node_modules should be excluded via .dockerignore) COPY ui/ ./ -# Build the application (with node adapter) +# Build the app RUN --mount=type=cache,target=/root/.npm \ npm run build -# Production stage -FROM node:22-alpine + +########### Runtime: minimal production image ########### +FROM node:22-alpine AS runner WORKDIR /app -# Copy package file +# Set env before install so some libs can optimize for production +ENV NODE_ENV=production +ENV PORT=3030 +ENV HOST=0.0.0.0 + +# Install only production deps COPY ui/package.json ui/package-lock.json ./ -# Install production dependencies only -# npm will automatically install correct platform-specific binaries (amd64 or arm64) RUN --mount=type=cache,target=/root/.npm \ - npm ci --omit=dev && \ - npm cache clean --force + npm ci --omit=dev -# Copy built application and server entry from builder +# Bring in built assets and server entry from builder COPY --from=builder /app/dist ./dist COPY --from=builder /app/server-start.js ./ -# Expose port EXPOSE 3030 -# Set environment variables -ENV NODE_ENV=production -ENV PORT=3030 -ENV HOST=0.0.0.0 - -# Start the Node.js production server CMD ["node", "server-start.js"] -