Skip to content

Commit

Permalink
Move build args to .env file
Browse files Browse the repository at this point in the history
  • Loading branch information
julianocosta89 committed Nov 6, 2024
1 parent 1002cf0 commit 6b81187
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ VALKEY_IMAGE=valkey/valkey:8.0-alpine
# must also update the version arg in ./test/tracetesting/Dockerfile
TRACETEST_IMAGE=kubeshop/tracetest:v1.5.2

# Build Args
OTEL_JAVA_AGENT_VERSION=2.9.0

# Demo Platform
ENV_PLATFORM=local

Expand Down
9 changes: 9 additions & 0 deletions .github/workflows/component-build-images.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,15 @@ jobs:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Load .env variables
if: ${{ inputs.push }}
run: |
set -a
source <(grep -vE '^\s*#|^\s*$' .env)
set +a
for var in $(cat .env | cut -d= -f1); do
echo "$var=${!var}" >> $GITHUB_ENV
done
- name: Check for changes and set push options
id: check_changes
run: |
Expand Down
4 changes: 2 additions & 2 deletions src/adservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ RUN ./gradlew installDist -PprotoSourceDir=./proto

FROM eclipse-temurin:21-jre

ARG version=2.6.0
ARG OTEL_JAVA_AGENT_VERSION
WORKDIR /usr/src/app/

COPY --from=builder /usr/src/app/ ./
ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/opentelemetry-javaagent.jar /usr/src/app/opentelemetry-javaagent.jar
ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$OTEL_JAVA_AGENT_VERSION/opentelemetry-javaagent.jar /usr/src/app/opentelemetry-javaagent.jar
ENV JAVA_TOOL_OPTIONS=-javaagent:/usr/src/app/opentelemetry-javaagent.jar

EXPOSE ${AD_SERVICE_PORT}
Expand Down
4 changes: 2 additions & 2 deletions src/frauddetectionservice/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ RUN gradle shadowJar

FROM gcr.io/distroless/java17-debian11

ARG version=2.4.0
ARG OTEL_JAVA_AGENT_VERSION
WORKDIR /usr/src/app/

COPY --from=builder /usr/src/app/build/libs/frauddetectionservice-1.0-all.jar ./
ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar
ADD --chmod=644 https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$OTEL_JAVA_AGENT_VERSION/opentelemetry-javaagent.jar /app/opentelemetry-javaagent.jar
ENV JAVA_TOOL_OPTIONS=-javaagent:/app/opentelemetry-javaagent.jar

ENTRYPOINT [ "java", "-jar", "frauddetectionservice-1.0-all.jar" ]
4 changes: 2 additions & 2 deletions src/kafka/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
FROM apache/kafka:3.7.0

USER root
ARG version=2.4.0
ARG OTEL_JAVA_AGENT_VERSION

USER appuser

ADD --chown=appuser:appuser https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$version/opentelemetry-javaagent.jar /tmp/opentelemetry-javaagent.jar
ADD --chown=appuser:appuser https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v$OTEL_JAVA_AGENT_VERSION/opentelemetry-javaagent.jar /tmp/opentelemetry-javaagent.jar

ENV KAFKA_LISTENERS=PLAINTEXT://0.0.0.0:9092,CONTROLLER://0.0.0.0:9093
ENV KAFKA_CONTROLLER_QUORUM_VOTERS='[email protected]:9093'
Expand Down

0 comments on commit 6b81187

Please sign in to comment.