Dockerfile 1.3 KB

12345678910111213141516171819202122232425262728
  1. FROM alpine:3.10 as build
  2. ARG branch=release
  3. ARG gradle_version=5.2.1
  4. RUN mkdir /root/.ssh
  5. COPY id_rsa /root/.ssh
  6. RUN apk add --update wget figlet unzip maven openjdk8 git openssh \
  7. && wget https://services.gradle.org/distributions/gradle-${gradle_version}-bin.zip -q -P /tmp \
  8. && unzip -d /opt/gradle /tmp/gradle-${gradle_version}-bin.zip \
  9. && export GRADLE_HOME=/opt/gradle/gradle-${gradle_version} \
  10. && export PATH=${GRADLE_HOME}/bin:${PATH} \
  11. && gradle -v \
  12. && printf "Host git.alfatell.ru \n\tStrictHostKeyChecking no" > /root/.ssh/config \
  13. && git clone ssh://gitolite@git.alfatell.ru:2223/web-registration-cloud.git \
  14. && cd web-registration-cloud && git checkout ${branch} \
  15. && echo $(git log -p -1 --pretty=format:"%h"|head -n1) > /tmp/version && cd customer-api \
  16. && mvn clean install && cd ../promo/ \
  17. && figlet -c Building Promo \
  18. && gradle tasks bootWar \
  19. && rm -rf /root/.ssh/id_rsa
  20. FROM registry.sdsys.ru/iru/iru-base:7.6
  21. ARG DB_CLUSTER=mongodb1:27017,mongodb2:27018,mongodb3:27019
  22. ARG SERVER_PORT=9000
  23. HEALTHCHECK --start-period=30s --interval=15s --timeout=5s --retries=2 CMD curl -f 127.0.0.1:${SERVER_PORT} || exit 1
  24. COPY --from=build /web-registration-cloud/promo/build/libs/promo-0.0.1-SNAPSHOT.war /opt/
  25. COPY --from=build /tmp/version /tmp/
  26. CMD ["java", "-jar", "/opt/promo-0.0.1-SNAPSHOT.war"]