-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change artifact type to war file, add Tomcat support and add Dockerfi…
…le (#36) * Change artifact type to war webapps for Tomcat support and adding Dockerfile. * Added Dockerfile. * Adapted Eiffel-ViCi application for external Tomcat webapp application. * Updated Readme txt file how to run Eiffel-ViCi Docker container. * Some more Docker run documentation in readme file. * Fixed indentation in pom file. * Fix indentations in pom file.
- Loading branch information
1 parent
48ec003
commit 0ad5c91
Showing
7 changed files
with
130 additions
and
22 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
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,14 @@ | ||
FROM frolvlad/alpine-oraclejdk8:slim | ||
VOLUME /tmp | ||
ADD maven/vici-eiffel-0.0.1-SNAPSHOT.jar app.jar | ||
RUN sh -c 'touch /app.jar' | ||
ENV JAVA_OPTS="" | ||
EXPOSE 8080 | ||
ENTRYPOINT [ "sh", "-c", "java $JAVA_OPTS -Djava.security.egd=file:/dev/./urandom -jar /app.jar" ] | ||
FROM tomcat:8.0-jre8 | ||
MAINTAINER Eiffel-Community | ||
|
||
ARG URL | ||
RUN echo Building Eiffel-Image image based on artifact url: ${URL} | ||
|
||
# Create image with existing war file. User need to execute 'mvn package -DskipTest' before 'docker build' | ||
RUN ["rm", "-fr", "/usr/local/tomcat/webapps/ROOT"] | ||
ADD ./src/main/docker/health-check.sh /eiffel/health-check.sh | ||
ADD ./src/main/docker/start-service.sh /eiffel/start-service.sh | ||
ADD ${URL} /usr/local/tomcat/webapps/ROOT.war | ||
|
||
|
||
CMD ["/eiffel/start-service.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
A: Build Eiffel-ViCi Docker image based on Eiffel-ViCi from an Artifactory, e.g. Jitpack: | ||
cd (git root dir) | ||
docker build -t eiffel-intelligence:0.0.19 --build-arg URL=https://jitpack.io/com/github/eiffel-community/eiffel-vici/0.0.1/eiffel-vici-0.0.1.war -f src/main/docker/Dockerfile . | ||
|
||
|
||
|
||
B: Build Eiffel-ViCi based on local Eiffel-ViCi source code changes | ||
1. Build Eiffel-ViCi service artifact war file: | ||
cd (git root dir) | ||
mvn package -DskipTests | ||
|
||
2. Build Eiffel-ViCi Docker image: | ||
cd (git root dir)/ | ||
docker build -t eiffel-vici:0.0.1 --build-arg URL=./target/eiffel-vici-0.0.1.war -f src/main/docker/Dockerfile . | ||
|
||
|
||
# Run Eiffel-ViCi in Docker: | ||
docker run -p 8080:8080 --expose 8080 -e server.port=8080 -e logging.level.root=DEBUG -e logging.level.org.springframework.web=INFO eiffel-vici:0.0.1 | ||
|
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,43 @@ | ||
#!/bin/bash | ||
|
||
#NC_BIN=nc.traditional | ||
#NC_BIN=nc | ||
SLEEP_LENGTH=8 | ||
|
||
WAIT_HOSTS="${@}" | ||
|
||
echo "Will wait for fallowing hosts getting started:" | ||
echo "${WAIT_HOSTS}" | ||
|
||
wait_for_service() { | ||
echo Waiting for $1 to listen on $2... | ||
LOOP=1 | ||
while [ "$LOOP" != "0" ]; | ||
do | ||
echo "Waiting on host: ${1}:${2}" | ||
sleep $SLEEP_LENGTH | ||
curl $1:$2 | ||
RESULT=$? | ||
echo "Service check result: $RESULT" | ||
if [ $RESULT == 0 ] | ||
then | ||
LOOP=0 | ||
fi | ||
done | ||
} | ||
|
||
echo | ||
echo "Waiting for components to start" | ||
echo | ||
|
||
for URL in `echo "${WAIT_HOSTS}"` | ||
do | ||
wait_for_service `echo $URL | sed s/\:/\ /` | ||
echo "Host $URL detected started." | ||
done | ||
|
||
echo | ||
echo "All services detected as started." | ||
echo | ||
|
||
exit 0 |
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,21 @@ | ||
#!/bin/bash | ||
|
||
# These two varibales need to be set from Docker-compose or K8S at startup if MB and/or DB healthcheck should be used. | ||
#WAIT_MB_HOSTS="localhost:15672 localhost:15672" | ||
|
||
if [ ! -z "$WAIT_MB_HOSTS" ] | ||
then | ||
/eiffel/health-check.sh "$WAIT_MB_HOSTS" | ||
fi | ||
|
||
if [ ! -z "$WAIT_DB_HOSTS" ] | ||
then | ||
/eiffel/health-check.sh "$WAIT_DB_HOSTS" | ||
fi | ||
|
||
|
||
echo | ||
echo "Starting Eiffel-ViCi" | ||
echo | ||
|
||
catalina.sh run |
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