From 7db91bb5943ac4a25723e63f6b0bb202e44a5a50 Mon Sep 17 00:00:00 2001 From: lklynet Date: Thu, 1 Jan 2026 23:16:42 -0500 Subject: [PATCH] build(docker): optimize docker image size and build process Use slim base image and install build dependencies only when needed Rebuild native modules during install for production compatibility --- Dockerfile | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index a4659da..e310020 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,10 +1,18 @@ -FROM node:18 +FROM node:18-bullseye-slim WORKDIR /app +# Install build dependencies for native modules +RUN apt-get update && apt-get install -y \ + python3 \ + make \ + g++ \ + && rm -rf /var/lib/apt/lists/* + COPY package*.json ./ -RUN npm install --production +# Install dependencies with full rebuild +RUN npm install --production --build-from-source COPY server.js ./