diff --git a/.circleci/config.yml b/.circleci/config.yml index 9686852c1..53d06c79d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -70,6 +70,7 @@ jobs: - setup_build_environment - run: echo "Releasing version" && ./gradlew printVersion - run: ./gradlew publish + - run: DOCKER_TAG=${CIRCLE_TAG} make docker docker-push - run: name: "Copy artifacts to workspace" command: | diff --git a/Makefile b/Makefile index d73ba7ccd..641f46b06 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,9 @@ +DOCKER_IMAGE ?= hypertrace/javaagent +DOCKER_TAG ?= latest + +.PHONY: assemble +assemble: + ./gradlew assemble --stacktrace .PHONY: build build: @@ -13,6 +19,14 @@ muzzle: # for injecting helper classes from the same packages as instrumentations ./gradlew muzzle --no-daemon +.PHONY: docker +docker: assemble + docker build -f javaagent/Dockerfile javaagent/ -t ${DOCKER_IMAGE}:${DOCKER_TAG} + +.PHONY: docker-push +docker-push: + docker push ${DOCKER_IMAGE}:${DOCKER_TAG} + .PHONY: test test: ./gradlew check diff --git a/javaagent/Dockerfile b/javaagent/Dockerfile new file mode 100644 index 000000000..255136796 --- /dev/null +++ b/javaagent/Dockerfile @@ -0,0 +1,18 @@ +# This is a dockerfile that contains the Hypertrace javaagent. +# This image can be used to get the javaagent into app images or +# as Kubernetes init container to copy the javaagent into the volume mounted into the +# application container. + +FROM hypertrace/java:11 + +LABEL maintainer="Hypertrace 'https://www.hypertrace.org/'" + +ENV JAVAAGENT=/opt/hypertrace/hypertrace-agent-all.jar +COPY build/libs/hypertrace-agent-*-all.jar ${JAVAAGENT} + +# The following binaries are used by sidecar injector +# This statement tests if they exists in the image +RUN which base64 + +# env vars are not interpreted +CMD ["/opt/hypertrace/hypertrace-agent-all.jar"]