Skip to content

Commit

Permalink
fix kaniko build with symlink and missing binutils in amazoncorretto:…
Browse files Browse the repository at this point in the history
…21 image
  • Loading branch information
matihost committed Oct 11, 2023
1 parent 76712ef commit a452f50
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ jobs:
run: |
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"${{ env.REGISTRY }}\":{\"username\":\"${{ env.REGISTRY_USER }}\",\"password\":\"${{ env.REGISTRY_PASSWORD }}\"}}}" > /kaniko/.docker/config.json
/kaniko/executor -f ./Dockerfile -c "$(pwd)" --insecure --push-retry 2 - --skip-tls-verify --cache=false \
/kaniko/executor -f ./Dockerfile -c "$(pwd)" --insecure --ignore-path=/var/mail --ignore-path=/var/spool/mail --push-retry 2 --skip-tls-verify --cache=false \
--use-new-run --snapshot-mode=redo \
--build-arg JAR_FILE=target/*.jar \
--destination="${{ env.REGISTRY }}/matihost/mq/basic-client:${{ env.IMAGE_TAG }}"
java-image-cmdline:
Expand Down Expand Up @@ -166,7 +167,8 @@ jobs:
mkdir -p /kaniko/.docker
echo "{\"auths\":{\"${{ env.REGISTRY }}\":{\"username\":\"${{ env.REGISTRY_USER }}\",\"password\":\"${{ env.REGISTRY_PASSWORD }}\"}}}" > /kaniko/.docker/config.json
echo "Building Java commandline image"
/kaniko/executor -f ./Dockerfile -c "$(pwd)" --insecure --push-retry 2 - --skip-tls-verify --cache=false \
/kaniko/executor -f ./Dockerfile -c "$(pwd)" --insecure --ignore-path=/var/mail --ignore-path=/var/spool/mail --push-retry 2 --skip-tls-verify --cache=false \
--use-new-run --snapshot-mode=redo \
--build-arg JAR_FILE=target/*.jar \
--destination="${{ env.REGISTRY }}/matihost/commandline:${{ env.IMAGE_TAG }}"
codeql-java:
Expand Down
6 changes: 4 additions & 2 deletions java/apps/command-line/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
ARG JAR_FILE
# TODO bring back temuring when temurin 21 is released
# FROM eclipse-temurin:21 as jreBuilder
FROM amazoncorretto:21 as jreBuilder
# FROM amazoncorretto:21-alpine-jdk as jreBuilder
# RUN apk add --no-cache binutils
FROM maven:3-amazoncorretto-21-debian as jreBuilder
RUN apt -y update && apt -y install binutils
# build JRE with only modules app depens on
# + jfr and jcmd tooling (jcmd,jps,jmap,jstack etc.) ~ adds 6 MiB to image size
RUN jlink \
--add-modules java.base,java.xml,java.net.http,java.desktop,jdk.jcmd,jdk.jfr,jdk.management.jfr \
--verbose \
--strip-debug \
--compress 2 \
--no-header-files \
--no-man-pages \
--output /jre
Expand Down
6 changes: 4 additions & 2 deletions java/apps/mq/client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
ARG JAR_FILE
# TODO bring back temuring when temurin 21 is released
# FROM eclipse-temurin:21 as jreBuilder
FROM amazoncorretto:21 as jreBuilder
# FROM amazoncorretto:21-alpine-jdk as jreBuilder
# RUN apk add --no-cache binutils
FROM maven:3-amazoncorretto-21-debian as jreBuilder
RUN apt -y update && apt -y install binutils
# build JRE with only modules app depens on
# + jfr and jcmd tooling (jcmd,jps,jmap,jstack etc.) ~ adds 6 MiB to image size
RUN jlink \
--add-modules java.base,java.logging,java.naming,java.net.http,java.desktop,jdk.jcmd,jdk.jfr,jdk.management.jfr \
--verbose \
--strip-debug \
--compress 2 \
--no-header-files \
--no-man-pages \
--output /jre
Expand Down
2 changes: 1 addition & 1 deletion k8s/images/gh-images/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM alpine as certs
RUN apk --update add ca-certificates
FROM gcr.io/kaniko-project/executor:debug as kaniko
FROM maven:3-amazoncorretto-$JAVA_VERSION-debian
RUN apt -y update && apt -y install curl wget lsb-release gnupg apt-transport-https ca-certificates \
RUN apt -y update && apt -y install binutils curl wget lsb-release gnupg apt-transport-https ca-certificates \
&& curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key --keyring /usr/share/keyrings/cloud.google.gpg add - \
&& echo "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] https://packages.cloud.google.com/apt cloud-sdk main" > /etc/apt/sources.list.d/google-cloud-sdk.list \
&& wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor > /usr/share/keyrings/hashicorp-archive-keyring.gpg \
Expand Down

0 comments on commit a452f50

Please sign in to comment.