Fix dockerbuild & docker-compose for datahub-gms and start using Dockerize instead of wait-for-it for orchestration

This commit is contained in:
Kerem Sahin 2019-09-04 20:27:11 -07:00
parent 7a09f49396
commit 6b230872a4
2 changed files with 20 additions and 15 deletions

View File

@ -3,15 +3,22 @@ FROM openjdk:8
MAINTAINER Kerem Sahin ksahin@linkedin.com
COPY . datahub-src
RUN cd datahub-src && ./gradlew :gms:war:build -Prest.model.compatibility=ignore \
RUN cd datahub-src && ./gradlew :gms:war:build \
&& cp gms/war/build/libs/war.war ../gms.war && cd .. && rm -rf datahub-src
RUN apt-get update && apt-get install -y wget
RUN wget https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-runner/9.4.20.v20190813/jetty-runner-9.4.20.v20190813.jar
RUN wget https://github.com/vishnubob/wait-for-it/blob/master/wait-for-it.sh
ENV DOCKERIZE_VERSION v0.6.1
RUN wget https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& tar -C /usr/local/bin -xzvf dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz \
&& rm dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz
EXPOSE 8080
CMD ["./wait-for-it.sh", "$DATAHUB_MYSQL_HOST", "$DATAHUB_KAFKA_BROKER_HOST", "$DATAHUB_ELASTICSEARCH_HOST"]
CMD ["java", "-jar", "jetty-runner-9.4.20.v20190813.jar", "gms.war"]
CMD dockerize -wait tcp://$EBEAN_DATASOURCE_HOST \
-wait tcp://$KAFKA_BOOTSTRAP_SERVER \
-wait http://$ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT \
-timeout 60s \
java -jar jetty-runner-9.4.20.v20190813.jar gms.war

View File

@ -8,17 +8,15 @@ services:
ports:
- "8080:8080"
environment:
- ebean.datasourceUsername=datahub
- ebean.datasourcePassword=datahub
- ebean.datasourceUrl=jdbc:mysql://mysql:3306/datahub
- ebean.datasourceDriver=com.mysql.jdbc.Driver
- kafka.bootstrapServers=broker:29092
- kafka.schemaRegistryUrl=http://schema-registry:8081
- elasticsearch.hosts=elasticsearch
- elasticsearch.port=9200
- DATAHUB_MYSQL_HOST=mysql:3306
- DATAHUB_KAFKA_BROKER_HOST=broker:29092
- DATAHUB_ELASTICSEARCH_HOST=elasticsearch:9200
- EBEAN_DATASOURCE_USERNAME=datahub
- EBEAN_DATASOURCE_PASSWORD=datahub
- EBEAN_DATASOURCE_HOST=mysql:3306
- EBEAN_DATASOURCE_URL=jdbc:mysql://mysql:3306/datahub
- EBEAN_DATASOURCE_DRIVER=com.mysql.jdbc.Driver
- KAFKA_BOOTSTRAP_SERVER=broker:29092
- KAFKA_SCHEMAREGISTRY_URL=http://schema-registry:8081
- ELASTICSEARCH_HOST=elasticsearch
- ELASTICSEARCH_PORT=9200
networks:
default: