Skip to content

Commit 64de672

Browse files
pass secrets
1 parent f6905a5 commit 64de672

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

Dockerfile

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,20 +71,24 @@ COPY --from=ghcr.io/graalvm/native-image-community:25-ol10 /usr/lib64/graalvm/gr
7171
# Note:
7272
# 1. Token can be created here: https://cloud.oracle.com/?tenant=ddsbxplayground&domain=datadog&region=us-ashburn-1
7373
# 2. Once created, token should be added to GitHub protected environment by repository administrator.
74-
RUN <<-EOT
74+
RUN --mount=type=secret,id=oracle_java8_token <<-EOT
7575
set -eux
7676
sudo mkdir -p /usr/lib/jvm/oracle8
77+
# turn off tracing before touching secrets
78+
set +x
79+
ORACLE_JAVA8_TOKEN="$(cat /run/secrets/oracle_java8_token)"
7780
sudo curl -L --fail -H "token:${ORACLE_JAVA8_TOKEN}" https://java.oraclecloud.com/java/8/latest/jdk-8-linux-x64_bin.tar.gz | sudo tar -xvzf - -C /usr/lib/jvm/oracle8 --strip-components 1
81+
unset ORACLE_JAVA8_TOKEN
7882
EOT
7983

8084
# Remove cruft from JDKs that is not used in the build process.
8185
RUN <<-EOT
8286
sudo rm -rf \
83-
/usr/lib/jvm/*/man \
84-
/usr/lib/jvm/*/lib/src.zip \
85-
/usr/lib/jvm/*/demo \
86-
/usr/lib/jvm/*/sample \
87-
/usr/lib/jvm/graalvm*/lib/installer
87+
/usr/lib/jvm/*/man \
88+
/usr/lib/jvm/*/lib/src.zip \
89+
/usr/lib/jvm/*/demo \
90+
/usr/lib/jvm/*/sample \
91+
/usr/lib/jvm/graalvm*/lib/installer
8892
EOT
8993

9094
FROM scratch AS default-jdk

build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ function docker_build() {
7272
shift
7373
docker build \
7474
--build-arg LATEST_VERSION=$LATEST_VERSION \
75+
--secret id=oracle_java8_token,env=ORACLE_JAVA8_TOKEN \
7576
--platform linux/amd64 \
7677
--label org.opencontainers.image.created="$BUILD_DATE" \
7778
--label org.opencontainers.image.source=https://github.com/DataDog/dd-trace-java-docker-build \

0 commit comments

Comments
 (0)