Dockerfile-promo-sdk 1.3 KB

12345678910111213141516171819202122232425262728293031323334
  1. FROM images.sdsys.ru/sys/node:alpine as build
  2. ARG git_repo=git@github.com:icruportal/web-sdk-demo.git
  3. ARG branch=master
  4. COPY id_rsa /root/.ssh/
  5. RUN apk add --no-cache git openssh \
  6. && printf "Host github.com \n\tStrictHostKeyChecking no" > /root/.ssh/config \
  7. && git clone ${git_repo} \
  8. && cd web-sdk-demo && git checkout ${branch} \
  9. && echo $(git log -p -1 --pretty=format:"%h"|head -n1) > /tmp/version \
  10. && npm install \
  11. && rm -rf /root/.ssh/id_rsa
  12. FROM images.sdsys.ru/sys/node:alpine
  13. ARG DB_CLUSTER=mongodb1:27017,mongodb2:27018,mongodb3:27019
  14. ARG SERVER_PORT=9005
  15. RUN apk add --no-cache curl
  16. USER node
  17. HEALTHCHECK --start-period=40s --interval=15s --timeout=5s --retries=2 CMD curl -f 127.0.0.1:${SERVER_PORT} || exit 1
  18. COPY --from=build /web-sdk-demo/js /home/node/promo-sdk/js
  19. COPY --from=build /web-sdk-demo/page /home/node/promo-sdk/page
  20. COPY --from=build /web-sdk-demo/static /home/node/promo-sdk/static
  21. COPY --from=build /web-sdk-demo/style /home/node/promo-sdk/style
  22. COPY --from=build /web-sdk-demo/node_modules /home/node/promo-sdk/node_modules
  23. COPY --from=build /web-sdk-demo/server.js /home/node/promo-sdk/server.js
  24. COPY --from=build /web-sdk-demo/package.json /home/node/promo-sdk/package.json
  25. COPY --from=build /tmp/version /tmp/version
  26. WORKDIR /home/node/promo-sdk
  27. CMD ["npm", "run", "start"]