Skip to content

Commit

Permalink
Merge pull request #107 from RHEcosystemAppEng/hotfix/fix-broken-pipe…
Browse files Browse the repository at this point in the history
…line

fix: parameterize Dockerfile' jdk minor+patch version
  • Loading branch information
zvigrinberg authored Mar 10, 2024
2 parents 39b4f60 + 8bba929 commit e5e767e
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions docker-image/Dockerfiles/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
ARG JAVA_MINOR_PATCH_VERSION=0.2

# first stage
FROM registry.access.redhat.com/ubi9/nodejs-18 as builder

Expand All @@ -7,6 +9,8 @@ USER root
# assign token for reading packages from github package registry
ARG PACKAGE_REGISTRY_ACCESS_TOKEN=''

ARG JAVA_MINOR_PATCH_VERSION

# install Java
RUN curl -kL https://download.oracle.com/java/21/latest/jdk-21_linux-x64_bin.tar.gz -o /tmp/java-package.tar.gz \
&& tar xvzf /tmp/java-package.tar.gz -C /usr/
Expand All @@ -31,15 +35,15 @@ RUN yum install util-linux
# copy the .npmrc file
COPY configs/.npmrc .
# replace placeholder with the actual environment variable
RUN sed -i "s/__PACKAGE_REGISTRY_ACCESS_TOKEN__/${PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc
# install Exhort javascript API
RUN npm install --global @RHEcosystemAppEng/exhort-javascript-api

# add RHDA script
COPY scripts/rhda.sh /

ENV JDK_VERSION=jdk-21.${JAVA_MINOR_PATCH_VERSION}
# assign executable permissions to all installed binaries
RUN chmod +x /usr/jdk-21.0.1/bin/java \
RUN chmod +x /usr/${JDK_VERSION} \
&& chmod +x /usr/apache-maven-3.9.4/bin/mvn \
&& chmod +x /usr/go/bin/go \
&& chmod +x /usr/local/bin/pip3 \
Expand All @@ -56,16 +60,21 @@ FROM registry.access.redhat.com/ubi9/nodejs-18-minimal

LABEL org.opencontainers.image.source https://github.com/RHEcosystemAppEng/exhort-javascript-api

ARG JAVA_MINOR_PATCH_VERSION

# assign token for exhort authentication with Snyk provider
ENV EXHORT_SNYK_TOKEN=''
# assign rhda token for rhda user authentication with exhort
ENV RHDA_TOKEN=''
# assign rhda source for exhort tracking purposes
ENV RHDA_SOURCE=''

ENV JDK_VERSION=jdk-21.${JAVA_MINOR_PATCH_VERSION}

USER root
# Copy java executable from the builder stage
COPY --from=builder /usr/jdk-21.0.1/ /usr/jdk-21.0.1/
ENV JAVA_HOME=/usr/jdk-21.0.1
COPY --from=builder /usr/$JDK_VERSION/ /usr/$JDK_VERSION/
ENV JAVA_HOME=/usr/$JDK_VERSION

# Copy maven executable from the builder stage
COPY --from=builder /usr/apache-maven-3.9.4/ /usr/apache-maven-3.9.4/
Expand Down Expand Up @@ -100,3 +109,5 @@ COPY --from=builder /opt/app-root/src/.npm-global/ /opt/app-root/src/.npm-global

# Copy RHDA executable script from the builder stage
COPY --from=builder /rhda.sh /rhda.sh

USER 1001

0 comments on commit e5e767e

Please sign in to comment.