| 1 | FROM node:lts-alpine as builder |
| 2 | |
| 3 | # Build simulator |
| 4 | WORKDIR /usr/builder |
| 5 | COPY .npmrc package.json package-lock.json tsconfig.json rollup.config.mjs prepare.cjs build-requirements.mjs ./ |
| 6 | COPY src ./src |
| 7 | COPY docker/config.json ./src/assets/config.json |
| 8 | COPY docker/authorization-tags.json ./src/assets/authorization-tags.json |
| 9 | RUN set -ex \ |
| 10 | && apk add --no-cache --virtual .gyp build-base python3 \ |
| 11 | && npm set progress=false \ |
| 12 | && npm config set depth 0 \ |
| 13 | && npm cache clean --force \ |
| 14 | && npm clean-install \ |
| 15 | && npm run build \ |
| 16 | && apk del .gyp |
| 17 | |
| 18 | # Build simulator dashboard |
| 19 | WORKDIR /usr/builder/webui |
| 20 | COPY ui/web ./ |
| 21 | RUN set -ex \ |
| 22 | && npm set progress=false \ |
| 23 | && npm config set depth 0 \ |
| 24 | && npm cache clean --force \ |
| 25 | && npm clean-install \ |
| 26 | && npm run build |
| 27 | |
| 28 | FROM node:lts-alpine |
| 29 | |
| 30 | ARG STACK_TRACE_LIMIT=1024 |
| 31 | ARG MAX_OLD_SPACE_SIZE=768 |
| 32 | |
| 33 | ENV NODE_OPTIONS="--stack-trace-limit=${STACK_TRACE_LIMIT} --max-old-space-size=${MAX_OLD_SPACE_SIZE}" |
| 34 | |
| 35 | WORKDIR /usr/app |
| 36 | COPY --from=builder /usr/builder/webui ./webui |
| 37 | COPY --from=builder /usr/builder/node_modules ./node_modules |
| 38 | COPY --from=builder /usr/builder/dist ./dist |
| 39 | COPY README.md LICENSE ./ |
| 40 | COPY docker/start.sh /start.sh |
| 41 | COPY docker/autoconfig.sh /autoconfig.sh |
| 42 | RUN set -ex \ |
| 43 | && chmod +x /start.sh \ |
| 44 | && chmod +x /autoconfig.sh |
| 45 | |
| 46 | CMD /autoconfig.sh && /start.sh |