- Frontend: React 19 + Vite + TypeScript + TailwindCSS v4 + shadcn/ui - Pre-installed shadcn/ui components: Button, Card, Input, Separator - Multi-stage Dockerfile: build React client → serve with Express - Server.js updated to serve built React SPA with API routes - Sample landing page with shadcn/ui components demonstrating usage - Path aliases (@/) configured in tsconfig + vite config - components.json for easy `shadcn add <component>` usage Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
753 B
Docker
41 lines
753 B
Docker
FROM node:20-alpine AS builder
|
|
|
|
WORKDIR /app/client
|
|
|
|
# Install client dependencies and build
|
|
COPY client/package*.json ./
|
|
RUN npm install
|
|
|
|
COPY client/ ./
|
|
RUN npm run build
|
|
|
|
# --- Production stage ---
|
|
FROM node:20-alpine
|
|
|
|
ARG SOURCE_COMMIT=unknown
|
|
ARG APP_VERSION=1.0.0
|
|
|
|
WORKDIR /app
|
|
|
|
RUN apk add --no-cache curl
|
|
|
|
# Install server dependencies
|
|
COPY package*.json ./
|
|
RUN npm install --production
|
|
|
|
# Copy server code
|
|
COPY server.js ./
|
|
|
|
# Copy built React app from builder
|
|
COPY --from=builder /app/client/dist ./client/dist
|
|
|
|
ENV GIT_COMMIT=${SOURCE_COMMIT} \
|
|
APP_VERSION=${APP_VERSION}
|
|
|
|
EXPOSE 3000
|
|
|
|
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=2 \
|
|
CMD curl -f http://localhost:3000/health || exit 1
|
|
|
|
CMD ["node", "server.js"]
|