# Base image
FROM node:18.12.1-alpine as build

# Create app directory
WORKDIR /usr/src/app

# A wildcard is used to ensure both package.json AND package-lock.json are copied
COPY package*.json ./

# Install app dependencies
RUN npm install

# Bundle app source
COPY . .
RUN npm i bcrypt --save
RUN npm install -g prisma
RUN prisma generate


# Creates a "dist" folder with the production build
# RUN npm run build

RUN apk add --no-cache bash

EXPOSE 5172
# Start the server using the production build
CMD [ "npm", "run", "start:prod" ]