From be821528cb95ed825ef969000532b2c5c79c5f07 Mon Sep 17 00:00:00 2001 From: Caileb Date: Thu, 29 May 2025 16:05:51 -0500 Subject: [PATCH 1/2] Attempt to fix build issues in Docker --- Dockerfile | 10 +++++----- index.js | 5 +++++ package.json | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index fe4792d..371938e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,12 +4,12 @@ FROM node:18-alpine # Set working directory WORKDIR /app -# Copy package files, config script -COPY package.json package-lock.json esbuild.config.js ./ -# Copy application source before build so esbuild can locate entry files +# Copy package files and install dependencies +COPY package.json package-lock.json ./ +RUN npm ci --only=production + +# Copy application source COPY . . -# Install all dependencies, create dist folder, build with esbuild, then remove devDeps -RUN npm ci && mkdir -p dist && npm run build && npm prune --production # Expose the application port EXPOSE 3000 diff --git a/index.js b/index.js index 9b90686..596c713 100644 --- a/index.js +++ b/index.js @@ -58,6 +58,11 @@ if (process.argv.includes('-d')) { process.exit(0); } +// Disable console.log in production to suppress output in daemon mode +if (process.env.NODE_ENV === 'production') { + console.log = () => {}; +} + const pluginRegistry = []; export function registerPlugin(pluginName, handler) { pluginRegistry.push({ name: pluginName, handler }); diff --git a/package.json b/package.json index 3d40e76..a47e276 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "scripts": { "start": "node index.js", "dev": "nodemon index.js", - "daemon": "pm2 start dist/index.js --name checkpoint", + "daemon": "pm2 start index.js --name checkpoint", "stop": "pm2 stop checkpoint", "restart": "pm2 restart checkpoint", "logs": "pm2 logs checkpoint", From 8ffc999798899caadf5303ac29159929c56564df Mon Sep 17 00:00:00 2001 From: Caileb Date: Thu, 29 May 2025 16:05:54 -0500 Subject: [PATCH 2/2] Attempt to fix build issues in Docker --- esbuild.config.js | 15 --------------- 1 file changed, 15 deletions(-) delete mode 100644 esbuild.config.js diff --git a/esbuild.config.js b/esbuild.config.js deleted file mode 100644 index 504a746..0000000 --- a/esbuild.config.js +++ /dev/null @@ -1,15 +0,0 @@ -import { build } from 'esbuild'; - -build({ - entryPoints: ['index.js'], - bundle: true, - platform: 'node', - target: 'node18', - outfile: 'dist/index.js', - minify: true, - legalComments: 'none', - drop: ['console', 'debugger'], -}).catch((e) => { - console.error('esbuild failed:', e); - process.exit(1); -}); \ No newline at end of file