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