2025-08-06 15:15:22 +02:00
|
|
|
ARG NODE_VERSION=20.10.0
|
|
|
|
|
ARG PORT=6060
|
2025-08-06 14:31:16 +02:00
|
|
|
|
2025-08-06 15:15:22 +02:00
|
|
|
FROM node:${NODE_VERSION}-slim as base
|
|
|
|
|
ENV NODE_ENV=production
|
|
|
|
|
ENV NODE_OPTIONS=--max-old-space-size=8192
|
2025-08-06 14:31:16 +02:00
|
|
|
WORKDIR /app
|
|
|
|
|
|
2025-08-06 15:15:22 +02:00
|
|
|
FROM base as build
|
|
|
|
|
COPY package.json .
|
|
|
|
|
COPY package-lock.json .
|
|
|
|
|
RUN npm ci --production=false
|
2025-08-06 14:31:16 +02:00
|
|
|
COPY . .
|
|
|
|
|
RUN npm run build
|
2025-08-06 15:15:22 +02:00
|
|
|
RUN npm prune
|
2025-08-06 14:31:16 +02:00
|
|
|
|
2025-08-06 15:15:22 +02:00
|
|
|
FROM base as production
|
|
|
|
|
ENV PORT=$PORT
|
|
|
|
|
COPY --from=build /app/.output /app/.output
|
2025-08-06 14:31:16 +02:00
|
|
|
|
2025-08-06 15:15:22 +02:00
|
|
|
# Add health check
|
|
|
|
|
HEALTHCHECK --interval=30s --timeout=10s --start-period=40s --retries=3 \
|
|
|
|
|
CMD curl -f http://localhost:6060/api/health || exit 1
|
2025-08-06 14:31:16 +02:00
|
|
|
|
2025-08-06 15:15:22 +02:00
|
|
|
# Install curl for health check
|
|
|
|
|
RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/*
|
2025-08-06 14:31:16 +02:00
|
|
|
|
2025-08-06 15:15:22 +02:00
|
|
|
CMD ["node", ".output/server/index.mjs"]
|