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