Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 19 additions & 25 deletions Dockerfile_ui
Original file line number Diff line number Diff line change
@@ -1,50 +1,44 @@
# Multi-stage build for Taco UI
FROM node:20-alpine AS builder
# 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:20-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"]

Loading