Add node.js memory tuning to docker image
[e-mobility-charging-stations-simulator.git] / docker / Dockerfile
index d681e2950399916ea01b8f273c7757688bd9b2af..c132990575bf3be3ca891b1a23730fb4ba794e22 100644 (file)
@@ -6,18 +6,24 @@ COPY package.json package-lock.json ./
 
 RUN npm set progress=false && npm config set depth 0 && npm cache clean --force
 RUN npm install
+COPY tsconfig.json rollup.config.js ./
+COPY src ./src
+COPY docker/config.json ./src/assets/config.json
+RUN npm run build
 
 FROM node:lts-alpine
 
+ARG MAX_OLD_SPACE_SIZE
+
 WORKDIR /usr/app
 
+ENV NODE_OPTIONS=--max-old-space-size=${MAX_OLD_SPACE_SIZE}
+
 COPY --from=builder /usr/builder/node_modules ./node_modules
-COPY NOTICE LICENSE ./
-COPY src ./src
-COPY *.json ./
-COPY docker/config.json ./src/config.json
+COPY --from=builder /usr/builder/dist ./dist
+COPY README.md NOTICE LICENSE ./
 COPY docker/autoconfig.sh /autoconfig.sh
 RUN chmod +x /autoconfig.sh
 
-#CMD ["node", "src/index.js"]
-CMD /autoconfig.sh && node src/index.js
+#CMD ["node", "dist/start.js"]
+CMD /autoconfig.sh && node -r source-map-support/register dist/start.js