# Start from NodeJS image FROM node:22-alpine # Workdir definition WORKDIR /usr/src/back # Copy sources COPY . . # install deps, and pm2 to run the app RUN npm install # RUN npm install -g pm2 COPY .env.production .env # Compilation des fichiers TypeScript RUN npm run build # Review permissions RUN chown -R node:node ./ RUN chmod -R u=rwx,g=,o= ./ # Expose port EXPOSE 3000 # Start app CMD ["npm", "run", "startonly"] # CMD ["pm2", "start", "dist/app.js", "--no-daemon"]