FROM node:lts-alpine AS base

FROM base AS builder

WORKDIR /app

COPY package*.json ./

RUN npm ci

COPY . .

RUN npm run build

ENV REDIS_HOST=$REDIS_HOST
ENV REDIS_PORT=$REDIS_PORT
ENV REDIS_PASSWORD=$REDIS_PASSWORD
ENV EMS_PORT=$EMS_PORT

ENV DATABASE_URL=$DATABASE_URL

EXPOSE $EMS_PORT

CMD ["npm", "run", "start"]