| FROM node:20-alpine | |
| # Install build dependencies | |
| RUN apk add --no-cache make gcc g++ python3 | |
| # Create app directory | |
| WORKDIR /app | |
| # Install app dependencies | |
| COPY package*.json ./ | |
| # Install dependencies | |
| RUN npm install | |
| # Install additional dependencies | |
| RUN npm install mongoose bcrypt jsonwebtoken @nestjs/passport @nestjs/jwt passport-jwt passport-custom jwt-decode passport-local uuid i18n-ts | |
| # Rebuild bcrypt | |
| RUN npm rebuild bcrypt --build-from-source | |
| # Bundle app source | |
| COPY . . | |
| # Create the dist directory and set permissions | |
| RUN mkdir -p /app/dist && chown -R node:node /app | |
| # Switch to non-root user | |
| USER node | |
| # Expose the port the app runs on | |
| EXPOSE 7860 | |
| # Command to run the application | |
| CMD ["npm", "run", "start:dev"] | |