From: Jérôme Benoit Date: Wed, 2 Nov 2022 00:27:09 +0000 (+0100) Subject: Dockerfile: optimization X-Git-Tag: v1.1.87~12 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0e3069040a7c2653d6aacfb8d7c79582d3a5721a;p=e-mobility-charging-stations-simulator.git Dockerfile: optimization --- diff --git a/docker/Dockerfile b/docker/Dockerfile index 3d57d1a4..da34fdcf 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,25 +1,29 @@ FROM node:lts-alpine as builder -RUN apk add --no-cache --virtual .gyp \ - build-base \ - python3 - # Build simulator WORKDIR /usr/builder COPY .npmrc package.json package-lock.json tsconfig.json rollup.config.mjs prepare.js build-requirements.js ./ COPY src ./src COPY docker/config.json ./src/assets/config.json COPY docker/authorization-tags.json ./src/assets/authorization-tags.json -RUN npm set progress=false && npm config set depth 0 && npm cache clean --force && npm install -RUN npm run build +RUN set -ex \ + && apk add --no-cache --virtual .gyp build-base python3 \ + && npm set progress=false \ + && npm config set depth 0 \ + && npm cache clean --force \ + && npm clean-install \ + && npm run build \ + && apk del .gyp # Build simulator dashboard WORKDIR /usr/builder/webui COPY ui/web ./ -RUN npm set progress=false && npm config set depth 0 && npm cache clean --force && npm install -RUN npm run build - -RUN apk del .gyp +RUN set -ex \ + && npm set progress=false \ + && npm config set depth 0 \ + && npm cache clean --force \ + && npm clean-install \ + && npm run build FROM node:lts-alpine @@ -35,7 +39,8 @@ COPY --from=builder /usr/builder/dist ./dist COPY README.md LICENSE ./ COPY docker/start.sh /start.sh COPY docker/autoconfig.sh /autoconfig.sh -RUN chmod +x /start.sh -RUN chmod +x /autoconfig.sh +RUN set -ex \ + && chmod +x /start.sh \ + && chmod +x /autoconfig.sh CMD /autoconfig.sh && /start.sh diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index 6c4a7310..999f8a7e 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -9,7 +9,7 @@ services: dockerfile: docker/Dockerfile args: STACK_TRACE_LIMIT: 1024 - MAX_OLD_SPACE_SIZE: 1024 + MAX_OLD_SPACE_SIZE: 768 networks: - ev_network expose: