oof
This commit is contained in:
46
web/Dockerfile
Normal file
46
web/Dockerfile
Normal file
@@ -0,0 +1,46 @@
|
||||
# Stage 1: Dependencies
|
||||
FROM node:22-alpine AS deps
|
||||
RUN apk add --no-cache dumb-init
|
||||
WORKDIR /app
|
||||
|
||||
# Copy package files
|
||||
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml ./
|
||||
COPY web/package.json ./web/package.json
|
||||
COPY scheduler/package.json ./scheduler/package.json
|
||||
|
||||
# Install dependencies
|
||||
RUN corepack enable && pnpm install --frozen-lockfile
|
||||
|
||||
# Stage 2: Build
|
||||
FROM node:22-alpine AS build
|
||||
WORKDIR /app
|
||||
|
||||
# Copy source and dependencies
|
||||
COPY --from=deps /app/node_modules ./node_modules
|
||||
COPY --from=deps /app/web/node_modules ./web/node_modules
|
||||
COPY . .
|
||||
|
||||
# Build web application
|
||||
WORKDIR /app/web
|
||||
RUN NODE_ENV=production pnpm build
|
||||
|
||||
# Stage 3: Production
|
||||
FROM node:22-alpine AS runtime
|
||||
RUN apk add --no-cache dumb-init curl
|
||||
RUN addgroup -S appgroup && adduser -S appuser -G appgroup
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Copy production artifacts
|
||||
COPY --from=build /app/web/.output /app/.output
|
||||
COPY --from=build /app/web/package.json /app/package.json
|
||||
|
||||
# Use dumb-init for proper signal handling
|
||||
ENTRYPOINT ["dumb-init", "--"]
|
||||
USER appuser
|
||||
|
||||
EXPOSE 3000
|
||||
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
||||
CMD curl -f http://localhost:3000/api/health || exit 1
|
||||
|
||||
CMD ["node", ".output/server/index.mjs"]
|
||||
Reference in New Issue
Block a user