Skip to content

Commit 4c0bdac

Browse files
authored
Merge pull request #7 from CroffZ/main
Add appinsights java agent setup init container image
2 parents e180652 + 186d091 commit 4c0bdac

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Prerequisites:
2+
# 1. Shared volume mounted to /java-agent in both init-container and app container
3+
# 2. Environment variable CONNECTION_STRING in init container set to the Application Insights connection string
4+
5+
FROM mcr.microsoft.com/cbl-mariner/base/core:2.0
6+
7+
ARG version="3.5.4"
8+
9+
RUN tdnf update -y && tdnf install -y curl ca-certificates
10+
11+
RUN curl -L "https://github.com/microsoft/ApplicationInsights-Java/releases/download/${version}/applicationinsights-agent-${version}.jar" > agent.jar
12+
13+
ADD setup.sh /setup.sh
14+
15+
ENTRYPOINT ["/bin/sh", "setup.sh"]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
3+
if [[ -z "$CONNECTION_STRING" ]]; then
4+
echo "Environment variable CONNECTION_STRING is not found. Exiting..."
5+
exit 1
6+
else
7+
echo "{\"connectionString\": \"$CONNECTION_STRING\"}" > /java-agent/applicationinsights.json
8+
cp agent.jar /java-agent/agent.jar
9+
fi

0 commit comments

Comments
 (0)