Compare commits
2 commits
c5c30cf8c3
...
8ffc999798
| Author | SHA1 | Date | |
|---|---|---|---|
| 8ffc999798 | |||
| be821528cb |
4 changed files with 11 additions and 21 deletions
10
Dockerfile
10
Dockerfile
|
|
@ -4,12 +4,12 @@ FROM node:18-alpine
|
||||||
# Set working directory
|
# Set working directory
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
# Copy package files, config script
|
# Copy package files and install dependencies
|
||||||
COPY package.json package-lock.json esbuild.config.js ./
|
COPY package.json package-lock.json ./
|
||||||
# Copy application source before build so esbuild can locate entry files
|
RUN npm ci --only=production
|
||||||
|
|
||||||
|
# Copy application source
|
||||||
COPY . .
|
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 the application port
|
||||||
EXPOSE 3000
|
EXPOSE 3000
|
||||||
|
|
|
||||||
|
|
@ -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);
|
|
||||||
});
|
|
||||||
5
index.js
5
index.js
|
|
@ -58,6 +58,11 @@ if (process.argv.includes('-d')) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Disable console.log in production to suppress output in daemon mode
|
||||||
|
if (process.env.NODE_ENV === 'production') {
|
||||||
|
console.log = () => {};
|
||||||
|
}
|
||||||
|
|
||||||
const pluginRegistry = [];
|
const pluginRegistry = [];
|
||||||
export function registerPlugin(pluginName, handler) {
|
export function registerPlugin(pluginName, handler) {
|
||||||
pluginRegistry.push({ name: pluginName, handler });
|
pluginRegistry.push({ name: pluginName, handler });
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "node index.js",
|
"start": "node index.js",
|
||||||
"dev": "nodemon 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",
|
"stop": "pm2 stop checkpoint",
|
||||||
"restart": "pm2 restart checkpoint",
|
"restart": "pm2 restart checkpoint",
|
||||||
"logs": "pm2 logs checkpoint",
|
"logs": "pm2 logs checkpoint",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue