Prototype app made by google ai studio
This commit is contained in:
commit
f0ad8481c4
51 files changed
+12777
No files matched your search
+50
@@ -0,0 +1,50 @@
|
||||
# ========================================================
|
||||
# Stage 1: Build the React + Vite frontend and Express server
|
||||
# ========================================================
|
||||
FROM node:22-alpine AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Install dependencies first (layer caching)
|
||||
COPY package.json ./
|
||||
RUN npm install
|
||||
|
||||
# Copy application source code
|
||||
COPY . .
|
||||
|
||||
# Optional Build Argument for Google Maps API Key
|
||||
ARG VITE_GOOGLE_MAPS_API_KEY=""
|
||||
ENV VITE_GOOGLE_MAPS_API_KEY=$VITE_GOOGLE_MAPS_API_KEY
|
||||
|
||||
# Build production bundle (Vite client + server.cjs)
|
||||
RUN npm run build
|
||||
|
||||
# ========================================================
|
||||
# Stage 2: Serve full-stack application (API + SPA) with Node.js
|
||||
# ========================================================
|
||||
FROM node:22-alpine AS runner
|
||||
|
||||
WORKDIR /app
|
||||
ENV NODE_ENV=production
|
||||
ENV PORT=3000
|
||||
|
||||
# Install production dependencies only
|
||||
COPY package.json ./
|
||||
RUN npm install --omit=dev && npm cache clean --force
|
||||
|
||||
# Copy built bundle from builder stage
|
||||
COPY --from=builder /app/dist ./dist
|
||||
|
||||
# Create persistent database directory
|
||||
RUN mkdir -p /app/data
|
||||
VOLUME ["/app/data"]
|
||||
|
||||
# Expose HTTP application port
|
||||
EXPOSE 3000
|
||||
|
||||
# Container healthcheck
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD wget --quiet --tries=1 --spider http://localhost:3000/healthz || exit 1
|
||||
|
||||
# Start production full-stack server
|
||||
CMD ["node", "dist/server.cjs"]
|
||||
Reference in new issue
Block a user