dockerfile

This commit is contained in:
Alex Holliday committed 2025-12-10 17:43:35 +00:00
1 parent 93317cbba7
commit 85589d6d3a
2 files changed
+34 -3

No files matched your search

+6 -2
View File
@@ -1,5 +1,8 @@
# syntax=docker/dockerfile:1.6
ARG NODE_VERSION=20
# Build
FROM node:20-slim AS build
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-slim AS build
ENV NODE_OPTIONS="--max-old-space-size=4096"
WORKDIR /app
COPY package*.json ./
@@ -8,7 +11,8 @@ COPY . .
RUN npm run build
# Run stage
FROM nginx:1.27.1-alpine
ARG TARGETPLATFORM
FROM --platform=$TARGETPLATFORM nginx:1.27.1-alpine
# Environment variables
COPY --from=build /app/env.sh /docker-entrypoint.d/env.sh
+28 -1
View File
@@ -5,4 +5,31 @@ RUN npm ci
COPY . .
RUN npm run build
EXPOSE 52345
CMD ["node", "dist/index.js"]
CMD ["node", "dist/index.js"]
# syntax=docker/dockerfile:1.6
ARG NODE_VERSION=20
## Build stage (with dev deps, native to build platform)
FROM --platform=$BUILDPLATFORM node:${NODE_VERSION}-alpine AS build
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
RUN npm run build
## Production deps (native to target platform)
FROM --platform=$TARGETPLATFORM node:${NODE_VERSION}-alpine AS deps
WORKDIR /app
COPY package*.json ./
RUN npm ci --omit=dev
## Runtime image
FROM --platform=$TARGETPLATFORM node:${NODE_VERSION}-alpine
ENV NODE_ENV=production
WORKDIR /app
COPY --from=deps /app/node_modules ./node_modules
COPY package*.json ./
COPY --from=build /app/dist ./dist
EXPOSE 52345
CMD ["node", "dist/index.js"]