# The official nodejs docker image
FROM node:20.16-bullseye

ENV PYTHON=/usr/bin/python

COPY .npmrc package.json /tmp/
COPY common /tmp/common

RUN set -ex \
	&& cd /tmp \
	&& npm install -g node-gyp \
	&& yarn config set network-timeout 300000 \
	&& yarn install \
	&& rm -f /tmp/.npmrc \
	&& mkdir -p /home/app \
	&& cp -a /tmp/node_modules /home/app/ \
	&& cp -a /tmp/common /home/app/common \
	&& rm -Rf /tmp/*

WORKDIR /home/app

# Copy the rest of the files to the container workdir
ADD . /home/app

ENV PORT=9090
EXPOSE ${PORT}

CMD ["yarn", "start"]
