diff --git a/backend/src/main/docker/apm/Dockerfile b/backend/src/main/docker/apm/Dockerfile new file mode 100644 index 000000000..b17e5b87c --- /dev/null +++ b/backend/src/main/docker/apm/Dockerfile @@ -0,0 +1,22 @@ +FROM davinkevin/podcast-server:dev +MAINTAINER Kevin DAVIN + +# Exposed port for 4000 for the APM part +EXPOSE 4000 + +WORKDIR /opt +RUN mkdir -p /opt/glowroot && ls -al +COPY glowroot /opt/glowroot + +WORKDIR /opt/podcast-server +ENTRYPOINT ["java","-Djava.security.egd=file:/dev/./urandom", "-javaagent:/opt/glowroot/glowroot.jar","-jar","/opt/podcast-server/app.jar"] + +# RUN with docker like that : +# $ docker run -it -p 8080:8080 davinkevin/podcast-server:v1.0.0 + +# To configure it with external application.(properties|yaml), you can mount the file like this : +# +# $ docker run -it -v /path/to/application.yml:/opt/podcast-server/application.yml -p 8080:8080 davinkevin/podcast-server:dev-with-apm +# +# /!\ You can't override values defined as ENV in this Dockerfile through the application.yml. If you still want to, you have +# to use the `-e` flag of docker : -e podcastserver.backup.location='/opt/podcast-server/backup/' \ No newline at end of file diff --git a/backend/src/main/docker/apm/admin.json b/backend/src/main/docker/apm/admin.json new file mode 100644 index 000000000..3ec0f2c88 --- /dev/null +++ b/backend/src/main/docker/apm/admin.json @@ -0,0 +1,7 @@ +{ + "web": { + "port": 4000, + "bindAddress": "0.0.0.0", + "sessionTimeoutMinutes": 30 + } +} diff --git a/backend/src/main/docker/Dockerfile b/backend/src/main/docker/main/Dockerfile similarity index 100% rename from backend/src/main/docker/Dockerfile rename to backend/src/main/docker/main/Dockerfile diff --git a/docker-build.sh b/docker-build.sh index fdf6e926b..e5ada789a 100755 --- a/docker-build.sh +++ b/docker-build.sh @@ -2,12 +2,31 @@ set -euo pipefail +docker_build_with_apm () { + echo "build docker image davinkevin/podcast-server:$1-with-apm" + mkdir -p backend/target/docker + cp backend/src/main/docker/apm/Dockerfile backend/target/docker/ + + curl -L -o /tmp/glowroot.zip https://github.com/glowroot/glowroot/releases/download/v0.10.8/glowroot-0.10.8-dist.zip + unzip -o /tmp/glowroot.zip -d /tmp/ + cp -r /tmp/glowroot backend/target/docker/ + cp backend/src/main/docker/apm/admin.json backend/target/docker/glowroot/ + + cd backend/target/docker + docker build . -t davinkevin/podcast-server:$1-with-apm + + rm -rf /tmp/glowroot.zip /tmp/glowroot backend/target/docker + return +} + docker_build () { echo "build docker image davinkevin/podcast-server:$1" mkdir -p backend/target/docker - cp backend/target/Podcast-Server.jar backend/src/main/docker/Dockerfile backend/target/docker + cp backend/target/Podcast-Server.jar backend/src/main/docker/main/Dockerfile backend/target/docker/ cd backend/target/docker docker build . -t davinkevin/podcast-server:$1 + cd ../../.. + rm -rf backend/target/docker/* return } @@ -17,6 +36,7 @@ fi if [ "$TRAVIS_BRANCH" == "dev" ]; then docker_build dev + docker_build_with_apm dev exit 0; fi