FROM node:18-bullseye-slim

WORKDIR /app
COPY . .

RUN npm ci
RUN npm run build
RUN npm prune --production

EXPOSE 7860
ENV PORT=7860
ENV NODE_ENV=production

ARG CI_COMMIT_REF_NAME
ARG CI_COMMIT_SHA
ARG CI_PROJECT_PATH

ENV GITGUD_BRANCH=$CI_COMMIT_REF_NAME
ENV GITGUD_COMMIT=$CI_COMMIT_SHA
ENV GITGUD_PROJECT=$CI_PROJECT_PATH

CMD [ "npm", "start" ]
