Skip to content

Commit

Permalink
👻 Fix GitHub Action Builds (#56)
Browse files Browse the repository at this point in the history
Signed-off-by: Jason Montleon <[email protected]>
  • Loading branch information
jmontleon authored Aug 11, 2023
1 parent e0a0550 commit 8260f93
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 11 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/multi-arch_images_build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,15 @@ jobs:
with:
architectures: "amd64, arm64, ppc64le, s390x"
containerfile: "./Dockerfile"
extra-args: "--build-arg BUILDENV=github"
image_name: "jdtls-server-base"
image_namespace: "konveyor"
image_registry: "quay.io"
quay_publish_robot: ${{ secrets.QUAY_PUBLISH_ROBOT }}
quay_publish_token: ${{ secrets.QUAY_PUBLISH_TOKEN }}
pre_build_cmd: |
curl -s -o nexus-maven-repository-index.gz https://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz
unpigz nexus-maven-repository-index.gz
cat nexus-maven-repository-index | parallel -j150% --pipe --block 100M --cat grep -oaP "'[a-z][a-zA-Z0-9_.-]+\|[a-zA-Z][a-zA-Z0-9_.-]+\|([a-zA-Z0-9_.-]+\|)?(sources|pom|jar|maven-plugin|ear|ejb|ejb-client|java-source|rar|war)\|(jar|war|ear|pom|war|rar)'" {} | cut -d'|' -f1 | sed 's/$/.*/' | sort | uniq > hack/maven.default.index
rm -rf nexus-maven-repository-index
ref: ${{ github.ref }}
24 changes: 13 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,32 +1,34 @@
FROM registry.access.redhat.com/ubi9/ubi AS jdtls-download
WORKDIR /jdtls
RUN curl -o jdtls.tar.gz https://download.eclipse.org/jdtls/milestones/1.16.0/jdt-language-server-1.16.0-202209291445.tar.gz &&\
RUN curl -s -o jdtls.tar.gz https://download.eclipse.org/jdtls/milestones/1.16.0/jdt-language-server-1.16.0-202209291445.tar.gz &&\
tar -xvf jdtls.tar.gz --no-same-owner &&\
chmod 755 /jdtls/bin/jdtls
chmod 755 /jdtls/bin/jdtls &&\
rm -rf jdtls.tar.gz

FROM registry.access.redhat.com/ubi9/ubi AS maven-index
RUN curl -o nexus-maven-repository-index.gz https://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz &&\
gunzip -k nexus-maven-repository-index.gz &&\
grep -oaP '[a-z][a-zA-Z0-9_.-]+\|[a-zA-Z][a-zA-Z0-9_.-]+\|([a-zA-Z0-9_.-]+\|)?(sources|pom|jar|maven-plugin|ear|ejb|ejb-client|java-source|rar|war)\|(jar|war|ear|pom|war|rar)' nexus-maven-repository-index | cut -d'|' -f1 | sed 's/$/.*/' | sort | uniq > /maven.default.index
ARG BUILDENV=local
COPY hack/maven.default.index /maven.default.index
RUN if [ $BUILDENV == "local" ]; then curl -s -o nexus-maven-repository-index.gz https://repo.maven.apache.org/maven2/.index/nexus-maven-repository-index.gz &&\
zgrep -oaP '[a-z][a-zA-Z0-9_.-]+\|[a-zA-Z][a-zA-Z0-9_.-]+\|([a-zA-Z0-9_.-]+\|)?(sources|pom|jar|maven-plugin|ear|ejb|ejb-client|java-source|rar|war)\|(jar|war|ear|pom|war|rar)' nexus-maven-repository-index.gz | cut -d'|' -f1 | sed 's/$/.*/' | sort | uniq > /maven.default.index &&\
rm -rf nexus-maven-repository-index.gz; fi

FROM registry.access.redhat.com/ubi9/ubi AS fernflower
RUN dnf install -y maven-openjdk17 wget
RUN wget https://github.com/JetBrains/intellij-community/archive/refs/tags/idea/231.9011.34.tar.gz -O intellij-community.tar && tar xf intellij-community.tar
RUN dnf install -y maven-openjdk17 wget --setopt=install_weak_deps=False && dnf clean all && rm -rf /var/cache/dnf
RUN wget --quiet https://github.com/JetBrains/intellij-community/archive/refs/tags/idea/231.9011.34.tar.gz -O intellij-community.tar && tar xf intellij-community.tar intellij-community-idea-231.9011.34/plugins/java-decompiler/engine && rm -rf intellij-community.tar
WORKDIR /intellij-community-idea-231.9011.34/plugins/java-decompiler/engine
RUN export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
RUN ./gradlew build -x test
RUN ./gradlew build -x test && rm -rf /root/.gradle
RUN mkdir /output && cp ./build/libs/fernflower.jar /output

FROM registry.access.redhat.com/ubi9/ubi AS addon-build
RUN dnf install -y maven-openjdk17
RUN dnf install -y maven-openjdk17 && dnf clean all && rm -rf /var/cache/dnf
WORKDIR /app
COPY ./ /app/
RUN export JAVA_HOME=/usr/lib/jvm/java-17-openjdk
RUN JAVA_HOME=/usr/lib/jvm/java-17-openjdk mvn clean install -DskipTests=true

FROM registry.access.redhat.com/ubi9/ubi-minimal
RUN microdnf install -y python39 java-17-openjdk go-toolset maven-openjdk17
RUN microdnf clean all
RUN microdnf install -y python39 java-17-openjdk go-toolset maven-openjdk17 && microdnf clean all && rm -rf /var/cache/dnf
RUN go install golang.org/x/tools/gopls@latest
ENV JAVA_HOME /usr/lib/jvm/java-17-openjdk
COPY --from=jdtls-download /jdtls /jdtls/
Expand Down
14 changes: 14 additions & 0 deletions hack/maven.default.index
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Fake maven.default.index to COPY when BUILDENV=local
#
# This file takes far too long to generate on alternate architectures using
# emulation in GitHub actions.
#
# It is not possible to conditionally run a Dockerfile / Containerfile COPY
# But we can use an ARG to manipulate what happens in a RUN command, so we
# either overwrite this file in GitHub before starting the container build,
# copy it into the container and skip generating it within the container or
# copy it in and overwrite it within the container when building locally.
#
# This means no additional steps have to be added to the development workflow.
#
# If this message appears in a container image something went wrong.

0 comments on commit 8260f93

Please sign in to comment.