X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=docker%2FDockerfile;h=9843d05b86ed4b7defe6c6c756ae68fc51284572;hb=67623aa62669b072125219bb51cb46321a7342a9;hp=8884e89ebaba05e519ab5f532f3588c6b60a99e2;hpb=b79579e21c385c340738f3541ce6464b0eb2125f;p=e-mobility-charging-stations-simulator.git diff --git a/docker/Dockerfile b/docker/Dockerfile index 8884e89e..9843d05b 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,26 +1,41 @@ FROM node:lts-alpine as builder -WORKDIR /usr/builder - -COPY package.json package-lock.json ./ +RUN apk add --no-cache --virtual .gyp \ + build-base \ + python3 -RUN npm set progress=false && npm config set depth 0 && npm cache clean --force -RUN npm install -COPY tsconfig.json rollup.config.js ./ +# Build simulator +WORKDIR /usr/builder +COPY package.json package-lock.json tsconfig.json rollup.config.mjs prepare.js build-requirements.js ./ COPY src ./src -COPY src/assets/authorization-tags-template.json ./src/assets/authorization-tags.json COPY docker/config.json ./src/assets/config.json +RUN npm set progress=false && npm config set depth 0 && npm cache clean --force && npm install +RUN npm run build + +# 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 apk del .gyp + FROM node:lts-alpine +ARG STACK_TRACE_LIMIT +ARG MAX_OLD_SPACE_SIZE + WORKDIR /usr/app +ENV NODE_OPTIONS="--stack-trace-limit=${STACK_TRACE_LIMIT} --max-old-space-size=${MAX_OLD_SPACE_SIZE}" + +COPY --from=builder /usr/builder/webui ./webui COPY --from=builder /usr/builder/node_modules ./node_modules COPY --from=builder /usr/builder/dist ./dist -COPY NOTICE LICENSE ./ +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", "dist/start.js"] -CMD /autoconfig.sh && node -r source-map-support/register dist/start.js +CMD /autoconfig.sh && /start.sh