-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build(docker): refactor docker build scripts #1687
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,14 @@ | |
Refer to [DataHub GMS Service](../../gms) to have a quick understanding of the architecture and | ||
responsibility of this service for the DataHub. | ||
|
||
## Build | ||
``` | ||
docker image build -t linkedin/datahub-gms -f docker/gms/Dockerfile . | ||
``` | ||
This command will build and deploy the image in your local store. | ||
|
||
## Run container | ||
## Build & Run | ||
``` | ||
cd docker/gms && docker-compose pull && docker-compose up | ||
cd docker/gms && docker-compose up --build | ||
``` | ||
This command will start the container. If you have the image available in your local store, this image will be used | ||
for the container otherwise it will download the `latest` image from Docker Hub and then start that. | ||
This command will rebuild the local docker image and start a container based on the image. | ||
|
||
To start a container using an existing image, run the same command without the `--build` flag. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
||
### Container configuration | ||
#### External Port | ||
|
@@ -66,6 +62,7 @@ The value of `ELASTICSEARCH_HOST` variable should be set to the host name of the | |
|
||
``` | ||
environment: | ||
- NEO4J_HOST=neo4j:7474 | ||
- NEO4J_URI=bolt://neo4j | ||
- NEO4J_USERNAME=neo4j | ||
- NEO4J_PASSWORD=datahub | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,13 @@ | |
Refer to [DataHub MAE Consumer Job](../../metadata-jobs/mae-consumer-job) to have a quick understanding of the architecture and | ||
responsibility of this service for the DataHub. | ||
|
||
## Build | ||
## Build & Run | ||
``` | ||
docker image build -t linkedin/datahub-mae-consumer -f docker/mae-consumer/Dockerfile . | ||
cd docker/mae-consumer && docker-compose up --build | ||
``` | ||
This command will build and deploy the image in your local store. | ||
This command will rebuild the docker image and start a container based on the image. | ||
|
||
## Run container | ||
``` | ||
cd docker/mae-consumer && docker-compose pull && docker-compose up | ||
``` | ||
This command will start the container. If you have the image available in your local store, this image will be used | ||
for the container otherwise it will download the `latest` image from Docker Hub and then start that. | ||
To start a container using a previously built image, run the same command without the `--build` flag. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
||
### Container configuration | ||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,18 +4,13 @@ | |
Refer to [DataHub MCE Consumer Job](../../metadata-jobs/mce-consumer-job) to have a quick understanding of the architecture and | ||
responsibility of this service for the DataHub. | ||
|
||
## Build | ||
## Build & Run | ||
``` | ||
docker image build -t linkedin/datahub-mce-consumer -f docker/mce-consumer/Dockerfile . | ||
cd docker/mce-consumer && docker-compose up --build | ||
``` | ||
This command will build and deploy the image in your local store. | ||
This command will rebuild the docker image and start a container based on the image. | ||
|
||
## Run container | ||
``` | ||
cd docker/mce-consumer && docker-compose pull && docker-compose up | ||
``` | ||
This command will start the container. If you have the image available in your local store, this image will be used | ||
for the container otherwise it will download the `latest` image from Docker Hub and then start that. | ||
To start a container using a previously built image, run the same command without the `--build` flag. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto. |
||
|
||
### Container configuration | ||
|
||
|
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it would be good to note that: Once you build an image in your local,
docker-compose up
will simply use already built image, it will not pull the latest image from Docker Hub. You need to force it to pull the latest image by runningdocker-compose pull
before running up.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe the intention of these Dockerfiles is for local development, instead of quickstart. As such pulling the latest image from docker hub is probably not a common operation in this case?