Reduce ion-web size
476Mb -> 33.5MB
Resolves
-FROM node:12.16.0-buster-slim
+FROM alpine
-WORKDIR /app
-COPY ./sdk/js/package.json ./
-RUN npm install
-
-COPY ./sdk/js/demo/package.json ./demo/
-WORKDIR /app/demo
-RUN npm install
-
-WORKDIR /app
-COPY ./sdk/js ./
-
-WORKDIR /app/demo
-RUN npm run build
+ENV ENABLE_TELEMETRY="false"
+WORKDIR /usr/src/ion
-RUN apt-get update && apt-get install -y \
- curl \
- && rm -rf /var/lib/apt/lists/*
+COPY ./sdk/js /usr/src/ion
+RUN apk add --no-cache --update nodejs npm \
+ && mkdir -p /app/demo \
+ && npm install \
+ && cd demo \
+ && npm install \
+ && npm run build \
+ && mv dist /app/demo \
+ && rm -rf /usr/src/ion /root/.npm /tmp/* \
+ && apk del --no-cache nodejs npm
-ENV ENABLE_TELEMETRY="false"
-RUN curl https://getcaddy.com | bash -s personal
+RUN apk add --no-cache --update curl bash \
+ && curl https://getcaddy.com | bash -s personal \
+ && apk del --no-cache curl bash
ENTRYPOINT ["/usr/local/bin/caddy"]
CMD ["--conf", "/etc/Caddyfile", "--log", "stdout", "--agree=true"]
