Skip to content

Commit

Permalink
chore(apm): add apm to do analysis on docker build phase
Browse files Browse the repository at this point in the history
Closes #95
  • Loading branch information
davinkevin committed Jul 31, 2018
1 parent a2683fa commit ec1b101
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 1 deletion.
22 changes: 22 additions & 0 deletions backend/src/main/docker/apm/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
FROM davinkevin/podcast-server:dev
MAINTAINER Kevin DAVIN <https://github.com/davinkevin/Podcast-Server/issues>

# 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/'
7 changes: 7 additions & 0 deletions backend/src/main/docker/apm/admin.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"web": {
"port": 4000,
"bindAddress": "0.0.0.0",
"sessionTimeoutMinutes": 30
}
}
File renamed without changes.
22 changes: 21 additions & 1 deletion docker-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand All @@ -17,6 +36,7 @@ fi

if [ "$TRAVIS_BRANCH" == "dev" ]; then
docker_build dev
docker_build_with_apm dev
exit 0;
fi

Expand Down

0 comments on commit ec1b101

Please sign in to comment.