X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docker%2FDockerfile;h=6e77eba832e3ed44906d290727e2c2ef72d9c00a;hb=293c552db1b65507cd2b96e0b7ae41fa59f8fc1e;hp=32ef353daf68a062e96b3fa9c108f0a472e6330c;hpb=4d127f7fc6712dd32fb8ca3da47989e0c911ffe9;p=e-mobility-charging-stations-simulator.git diff --git a/docker/Dockerfile b/docker/Dockerfile index 32ef353d..6e77eba8 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,23 +1,41 @@ 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 -COPY package.json package-lock.json ./ +# Build simulator dashboard +WORKDIR /usr/builder/webui +COPY src/ui/web ./ +RUN npm set progress=false && npm config set depth 0 && npm cache clean --force && npm install +RUN npm run build -RUN npm set progress=false && npm config set depth 0 && npm cache clean --force -RUN npm install +RUN apk del .gyp FROM node:lts-alpine -WORKDIR /usr/app +ARG STACK_TRACE_LIMIT +ARG MAX_OLD_SPACE_SIZE +ENV NODE_OPTIONS="--stack-trace-limit=${STACK_TRACE_LIMIT} --max-old-space-size=${MAX_OLD_SPACE_SIZE}" + +WORKDIR /usr/app +COPY --from=builder /usr/builder/webui ./webui COPY --from=builder /usr/builder/node_modules ./node_modules -COPY NOTICE LICENSE ./ -COPY src ./src -COPY *.json ./ -COPY docker/config.json ./src/assets/config.json +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 -#CMD ["node", "src/index.js"] -CMD /autoconfig.sh && node src/index.js +CMD /autoconfig.sh && /start.sh