Add node.js memory tuning to docker image
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 25 Sep 2021 11:01:46 +0000 (13:01 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 25 Sep 2021 11:01:46 +0000 (13:01 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@piment-noir.org>
docker/Dockerfile
docker/config.json
docker/docker-compose.yml

index 531bb43f9153576083fe24ae6ca86008baed57e4..c132990575bf3be3ca891b1a23730fb4ba794e22 100644 (file)
@@ -13,8 +13,12 @@ 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 --from=builder /usr/builder/dist ./dist
 COPY README.md NOTICE LICENSE ./
index d49c4040ac9d1ab4d680d7402d2aa2be93754825..51c985d6960915a7a1475a9f06c453885d1744bf 100644 (file)
@@ -3,7 +3,6 @@
     "ws://server:8010/OCPP16/5c866e81a2d9593de43efdb4"
   ],
   "distributeStationsToTenantsEqually": true,
-  "statisticsDisplayInterval": 60,
   "workerProcess": "workerSet",
   "workerPoolMinSize": 4,
   "workerPoolMaxSize": 16,
@@ -37,5 +36,6 @@
   "logRotate": false,
   "logConsole": false,
   "logFile": "/dev/stdout",
-  "logErrorFile": "/dev/stderr"
+  "logErrorFile": "/dev/stderr",
+  "logStatisticsInterval": 60
 }
index e34223d73b1355310f2a6bed5acfe736a0517c56..ebc8d8b9f8d6e1e57c93bbdfa116e043690df780 100644 (file)
@@ -1,12 +1,13 @@
 version: '3.7'
 networks:
-    ev_network:
-      driver: bridge
-
+  ev_network:
+    driver: bridge
 services:
-    charging-stations-simulator:
-        build:
-            context: ..
-            dockerfile: docker/Dockerfile
-        networks:
-            - ev_network
+  charging-stations-simulator:
+    build:
+      context: ..
+      dockerfile: docker/Dockerfile
+      args:
+        MAX_OLD_SPACE_SIZE: 1024
+    networks:
+      - ev_network