Преглед изворни кода

Добавил Dockerfile для SDK

Tomishinets Vladimir пре 3 година
родитељ
комит
80d116b121
1 измењених фајлова са 32 додато и 0 уклоњено
  1. 32 0
      Dockerfile-promo-sdk

+ 32 - 0
Dockerfile-promo-sdk

@@ -0,0 +1,32 @@
+FROM node:alpine as build
+ARG git_repo=git@github.com:icruportal/web-sdk-demo.git
+ARG branch=master
+
+COPY id_rsa /root/.ssh/
+RUN apk add --no-cache git openssh \
+    && printf "Host github.com \n\tStrictHostKeyChecking no" > /root/.ssh/config \
+    && git clone ${git_repo} \
+    && cd web-sdk-demo && git checkout ${branch} \
+    && echo $(git log -p -1 --pretty=format:"%h"|head -n1) > /tmp/version  \
+    && npm install \
+    && rm -rf /root/.ssh/id_rsa
+
+FROM node:alpine
+ARG DB_CLUSTER=mongodb1:27017,mongodb2:27018,mongodb3:27019
+ARG SERVER_PORT=9005
+
+USER node
+
+HEALTHCHECK --start-period=40s --interval=15s --timeout=5s --retries=2 CMD curl -f 127.0.0.1:${SERVER_PORT} || exit 1
+COPY --from=build /web-sdk-demo/js /home/node/promo-sdk/js
+COPY --from=build /web-sdk-demo/page /home/node/promo-sdk/page
+COPY --from=build /web-sdk-demo/static /home/node/promo-sdk/static
+COPY --from=build /web-sdk-demo/style /home/node/promo-sdk/style
+COPY --from=build /web-sdk-demo/node_modules /home/node/promo-sdk/node_modules
+COPY --from=build /web-sdk-demo/server.js /home/node/promo-sdk/server.js
+COPY --from=build /web-sdk-demo/package.json /home/node/promo-sdk/package.json
+COPY --from=build /tmp/version /home/node/promo-sdk
+
+WORKDIR /home/node/promo-sdk
+
+CMD ["npm", "run", "start"]