From 525935a5df9cd2b0ab4fc11c8231241bd9cb1b96 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Sat, 25 Sep 2021 13:01:46 +0200 Subject: [PATCH] Add node.js memory tuning to docker image MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- docker/Dockerfile | 4 ++++ docker/config.json | 4 ++-- docker/docker-compose.yml | 19 ++++++++++--------- 3 files changed, 16 insertions(+), 11 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 531bb43f..c1329905 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -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 ./ diff --git a/docker/config.json b/docker/config.json index d49c4040..51c985d6 100644 --- a/docker/config.json +++ b/docker/config.json @@ -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 } diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e34223d7..ebc8d8b9 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -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 -- 2.34.1