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