diff --git a/.github/workflows/docker-unified.yml b/.github/workflows/docker-unified.yml index e36c9eff5c2c8..facf3c61aa832 100644 --- a/.github/workflows/docker-unified.yml +++ b/.github/workflows/docker-unified.yml @@ -341,7 +341,7 @@ jobs: with: context: . file: ./docker/datahub-upgrade/Dockerfile - platforms: linux/amd64 + platforms: linux/amd64,linux/arm64 tags: ${{ steps.docker_meta.outputs.tags }} push: true datahub_upgrade_scan: diff --git a/docker/datahub-upgrade/Dockerfile b/docker/datahub-upgrade/Dockerfile index 30c2e78feecae..7b1604ecaa7eb 100644 --- a/docker/datahub-upgrade/Dockerfile +++ b/docker/datahub-upgrade/Dockerfile @@ -1,16 +1,32 @@ # Defining environment ARG APP_ENV=prod -FROM adoptopenjdk/openjdk8:alpine-jre as base +FROM alpine:3.14 AS base ENV DOCKERIZE_VERSION v0.6.1 -RUN apk --no-cache add curl tar \ - && curl -L https://github.com/jwilder/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-amd64-$DOCKERIZE_VERSION.tar.gz | tar -C /usr/local/bin -xzv +# Upgrade Alpine and base packages +RUN apk --no-cache --update-cache --available upgrade \ + && if [ $(arch) = "aarch64" ]; then \ + DOCKERIZE_ARCH='aarch64';\ + elif [ $(arch) = "x86_64" ]; then \ + DOCKERIZE_ARCH='amd64'; \ + else \ + echo >&2 "Unsupported architecture $(arch)" ; exit 1; \ + fi \ + && apk --no-cache add tar curl openjdk8-jre bash coreutils gcompat \ + && curl https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-runner/9.4.46.v20220331/jetty-runner-9.4.46.v20220331.jar --output jetty-runner.jar \ + && curl https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-jmx/9.4.46.v20220331/jetty-jmx-9.4.46.v20220331.jar --output jetty-jmx.jar \ + && curl https://repo1.maven.org/maven2/org/eclipse/jetty/jetty-util/9.4.46.v20220331/jetty-util-9.4.46.v20220331.jar --output jetty-util.jar \ + && wget https://github.com/open-telemetry/opentelemetry-java-instrumentation/releases/download/v1.4.1/opentelemetry-javaagent-all.jar \ + && wget https://repo1.maven.org/maven2/io/prometheus/jmx/jmx_prometheus_javaagent/0.16.1/jmx_prometheus_javaagent-0.16.1.jar -O jmx_prometheus_javaagent.jar \ + && cp /usr/lib/jvm/java-1.8-openjdk/jre/lib/security/cacerts /tmp/kafka.client.truststore.jks \ + && curl -L https://github.com/treff7es/dockerize/releases/download/$DOCKERIZE_VERSION/dockerize-linux-${DOCKERIZE_ARCH}-$DOCKERIZE_VERSION.tar.gz | tar -C /usr/local/bin -xzv + +FROM --platform=$BUILDPLATFORM alpine:3.14 AS prod-build + +# Upgrade Alpine and base packages +RUN apk --no-cache --update-cache --available upgrade \ + && apk --no-cache add openjdk8 perl -# Workaround alpine issue with /lib64 not being in the ld library path -# https://gitlab.alpinelinux.org/alpine/aports/-/issues/10140 -ENV LD_LIBRARY_PATH=/lib64 - -FROM openjdk:8 as prod-build COPY . datahub-src RUN cd datahub-src && ./gradlew :datahub-upgrade:build RUN cd datahub-src && cp datahub-upgrade/build/libs/datahub-upgrade.jar ../datahub-upgrade.jar