diff --git a/Dockerfile b/Dockerfile index 9fb24dc..d0e7d46 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,30 +4,23 @@ WORKDIR /app RUN corepack enable +RUN npm install -g pm2 + # Copy package.json and your lockfile, here we add pnpm-lock.yaml for illustration -COPY package.json pnpm-lock.yaml .npmrc ./ +COPY package*.json ./ # Install dependencies -RUN pnpm i +RUN npm i # Copy the entire project -COPY . ./ +COPY . . # Build the project -RUN pnpm run build - -# Build Stage 2 - -FROM node:22-alpine -WORKDIR /app - -# Only `.output` folder is needed from the build stage -COPY --from=build /app/.output/ ./ +RUN yarn run build # Change the port and host ENV PORT=3001 -ENV HOST=0.0.0.0 -EXPOSE 80 +EXPOSE 3001 -CMD ["node", "/app/server/index.mjs"] \ No newline at end of file +CMD ["pm2-runtime", "start", "node_modules/.bin/nuxt", "--", "start"] \ No newline at end of file diff --git a/ecosystem.config.cjs b/ecosystem.config.cjs new file mode 100644 index 0000000..ce6f193 --- /dev/null +++ b/ecosystem.config.cjs @@ -0,0 +1,11 @@ +module.exports = { + apps: [ + { + name: 'Smash or Pass', + port: '3001', + exec_mode: 'cluster', + instances: 'max', + script: './.output/server/index.mjs' + } + ] +} \ No newline at end of file