FROM node:20-alpine

# Needed by certificates/pki.service.ts to shell out for CA/device cert generation.
RUN apk add --no-cache openssl

WORKDIR /usr/src/app

COPY package.json package-lock.json* ./
COPY prisma ./prisma
RUN npm install

COPY . .
RUN npm run build

EXPOSE 3001
CMD ["npm", "run", "start:prod"]
