FROM node:12.21-alpine
RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app

COPY ./dist/out-tsc /home/node/backend
COPY ./package.json /home/node/backend/package.json
WORKDIR /home/node/backend
RUN ls -ltra
#RUN rm node_modules -R
#RUN rm package-lock.json

#RUN chown node /opt/citron3 -Rf

RUN chmod -R 777 /home/node/backend

USER node

RUN npm install

EXPOSE 3000

CMD [ "node", "--experimental-json-modules", "server.js"]

