From 9c419bd09758ae0a4c66e1e42858624ce01c63cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lui=CC=81s=20Freitas?= Date: Wed, 9 Apr 2025 15:30:57 +0100 Subject: [PATCH] Update Dockerfile for Bitte AI application to use Node.js 20-slim, install Bun and PM2 for process management, and configure PM2 for production execution. --- apps/bitte-ai/Dockerfile | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/apps/bitte-ai/Dockerfile b/apps/bitte-ai/Dockerfile index 9c7d7b7..5f4a56c 100644 --- a/apps/bitte-ai/Dockerfile +++ b/apps/bitte-ai/Dockerfile @@ -1,7 +1,13 @@ -FROM oven/bun:1.2.1 +FROM node:20-slim WORKDIR /app +# Install Bun and PM2 for process management +RUN apt-get update && apt-get install -y curl unzip && \ + curl -fsSL https://bun.sh/install | bash && \ + ln -s $HOME/.bun/bin/bun /usr/local/bin/bun && \ + npm install -g pm2 + COPY package.json bun.lock ./ COPY apps/bitte-ai/package.json ./apps/bitte-ai/ @@ -16,5 +22,19 @@ RUN bun run build EXPOSE 3000 -# Run the compiled application -CMD ["bun", "run", "start"] \ No newline at end of file +# Create PM2 configuration +RUN echo '{\ + "apps": [{\ + "name": "bitte-ai",\ + "script": "dist/index.js",\ + "instances": "1",\ + "exec_mode": "cluster",\ + "max_memory_restart": "500M",\ + "env": {\ + "NODE_ENV": "production"\ + }\ + }]\ +}' > ecosystem.config.json + +# Run with PM2 in production mode +CMD ["pm2-runtime", "ecosystem.config.json"] \ No newline at end of file