From 2e21d1a4073bfbb6e588ed8e77eb587cf07a9e21 Mon Sep 17 00:00:00 2001 From: oonyeje Date: Tue, 7 Jul 2026 04:17:35 +0000 Subject: [PATCH] Update Dockerfile to multi-stage build that compiles TypeScript --- Dockerfile | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index e441035..c51321e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,25 @@ +# ---- Build stage ---------------------------------------------------------- +FROM node:20-alpine AS builder + +WORKDIR /app + +COPY package*.json tsconfig.json ./ +RUN npm install --no-audit --no-fund + +COPY src/ ./src/ +RUN npm run build + +# ---- Runtime stage -------------------------------------------------------- FROM node:20-alpine WORKDIR /app -# Install production dependencies +# Install only production dependencies COPY package*.json ./ -RUN npm install --omit=dev && npm cache clean --force +RUN npm install --omit=dev --no-audit --no-fund && npm cache clean --force -# Copy application code +# Copy compiled output and entry point +COPY --from=builder /app/dist ./dist COPY server.js ./ # Run as non-root user for security