-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build(docker): refactor docker build scripts (#1687)
* build(docker): refactor docker build scripts - add "build" option to docker-compose files to simplify rebuilding of images - create "start.sh" script so it's easier to override "command" in the quickstart's docker-compose file - use dockerize to wait for requisite services to start up - add a dedicated Dockerfile for kafka-setup This fixes #1549 & #1550
- Loading branch information
Showing
20 changed files
with
103 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
FROM openjdk:8 | ||
# This "container" is a workaround to pre-create search indices | ||
FROM jwilder/dockerize:0.6.1 | ||
|
||
MAINTAINER Kerem Sahin <[email protected]> | ||
|
||
RUN apt-get update && apt-get install -y wget && apt-get install -y curl | ||
RUN apk add --no-cache curl | ||
|
||
COPY corpuser-index-config.json dataset-index-config.json / | ||
|
||
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 | ||
|
||
CMD dockerize -wait http://$ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT \ | ||
-timeout 120s; \ | ||
curl -XPUT $ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT/corpuserinfodocument --data @corpuser-index-config.json; \ | ||
curl -XPUT $ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT/datasetdocument --data @dataset-index-config.json | ||
CMD dockerize \ | ||
-wait http://$ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT \ | ||
-timeout 120s \ | ||
curl -XPUT $ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT/corpuserinfodocument --data @corpuser-index-config.json && \ | ||
curl -XPUT $ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT/datasetdocument --data @dataset-index-config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
FROM openjdk:8 as builder | ||
|
||
MAINTAINER Kerem Sahin [email protected] | ||
|
||
RUN apt-get update && apt-get install -y wget \ | ||
&& wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb \ | ||
&& dpkg -i google-chrome-stable_current_amd64.deb; apt-get -fy install | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
|
||
dockerize \ | ||
-wait tcp://$EBEAN_DATASOURCE_HOST \ | ||
-wait tcp://$KAFKA_BOOTSTRAP_SERVER \ | ||
-wait http://$ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT \ | ||
-wait http://$NEO4J_HOST \ | ||
-timeout 240s \ | ||
java -jar jetty-runner.jar gms.war |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# This "container" is a workaround to pre-create topics | ||
FROM confluentinc/cp-kafka:5.4.0 | ||
|
||
CMD echo Waiting for Kafka to be ready... && \ | ||
cub kafka-ready -b $KAFKA_BOOTSTRAP_SERVER 1 60 && \ | ||
kafka-topics --create --if-not-exists --zookeeper $KAFKA_ZOOKEEPER_CONNECT --partitions 1 --replication-factor 1 --topic MetadataAuditEvent && \ | ||
kafka-topics --create --if-not-exists --zookeeper $KAFKA_ZOOKEEPER_CONNECT --partitions 1 --replication-factor 1 --topic MetadataChangeEvent && \ | ||
kafka-topics --create --if-not-exists --zookeeper $KAFKA_ZOOKEEPER_CONNECT --partitions 1 --replication-factor 1 --topic FailedMetadataChangeEvent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
FROM openjdk:8 as builder | ||
|
||
MAINTAINER Kerem Sahin [email protected] | ||
|
||
COPY . datahub-src | ||
RUN cd datahub-src && ./gradlew :metadata-jobs:mae-consumer-job:build \ | ||
&& cp metadata-jobs/mae-consumer-job/build/libs/mae-consumer-job.jar ../mae-consumer-job.jar \ | ||
|
@@ -13,7 +11,9 @@ RUN apk --no-cache add curl tar \ | |
&& curl -L https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | tar -C /usr/local/bin -xzv | ||
|
||
COPY --from=builder /mae-consumer-job.jar /mae-consumer-job.jar | ||
COPY docker/mae-consumer/start.sh /start.sh | ||
RUN chmod +x /start.sh | ||
|
||
EXPOSE 9091 | ||
|
||
ENTRYPOINT ["java", "-jar", "mae-consumer-job.jar"] | ||
CMD /start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
dockerize \ | ||
-wait tcp://$KAFKA_BOOTSTRAP_SERVER \ | ||
-wait http://$ELASTICSEARCH_HOST:$ELASTICSEARCH_PORT \ | ||
-wait http://$NEO4J_HOST \ | ||
-timeout 240s \ | ||
java -jar mae-consumer-job.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
FROM openjdk:8 as builder | ||
|
||
MAINTAINER Kerem Sahin [email protected] | ||
|
||
COPY . datahub-src | ||
RUN cd datahub-src && ./gradlew :metadata-jobs:mce-consumer-job:build \ | ||
&& cp metadata-jobs/mce-consumer-job/build/libs/mce-consumer-job.jar ../mce-consumer-job.jar \ | ||
&& cd .. && rm -rf datahub-src | ||
|
||
FROM openjdk:8-jre-alpine | ||
ENV DOCKERIZE_VERSION v0.6.1 | ||
RUN apk --no-cache add curl tar \ | ||
&& curl -L https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | tar -C /usr/local/bin -xzv | ||
|
||
COPY --from=builder /mce-consumer-job.jar /mce-consumer-job.jar | ||
COPY docker/mce-consumer/start.sh /start.sh | ||
RUN chmod +x /start.sh | ||
|
||
EXPOSE 9090 | ||
|
||
ENTRYPOINT ["java", "-jar", "mce-consumer-job.jar"] | ||
CMD /start.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
|
||
# -wait tcp://GMS_HOST:$GMS_PORT \ | ||
dockerize \ | ||
-wait tcp://$KAFKA_BOOTSTRAP_SERVER \ | ||
-timeout 240s \ | ||
java -jar mce-consumer-job.jar |
Oops, something went wrong.