diff --git a/.github/workflows/stage.yml b/.github/workflows/stage.yml index ace797c7..b97b479e 100644 --- a/.github/workflows/stage.yml +++ b/.github/workflows/stage.yml @@ -8,7 +8,7 @@ env: IMAGE_REGISTRY_USER: ${{ secrets.IMAGE_REGISTRY_USER }} IMAGE_REGISTRY_PASSWORD: ${{ secrets.IMAGE_REGISTRY_PASSWORD }} DOCKERFILE_PATH: ./docker-image/Dockerfiles/Dockerfile.alpha - GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN: ${{ secrets.GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN }} + PACKAGE_REGISTRY_ACCESS_TOKEN: ${{ secrets.PACKAGE_REGISTRY_ACCESS_TOKEN }} on: workflow_dispatch: @@ -96,7 +96,7 @@ jobs: dockerfiles: | ${{ env.DOCKERFILE_PATH }} build-args: | - GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN=${{ env.GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN }} + PACKAGE_REGISTRY_ACCESS_TOKEN=${{ env.PACKAGE_REGISTRY_ACCESS_TOKEN }} context: docker-image - name: Push Image To Registry diff --git a/docker-image/Dockerfiles/Dockerfile b/docker-image/Dockerfiles/Dockerfile index 535c1a98..064923a6 100644 --- a/docker-image/Dockerfiles/Dockerfile +++ b/docker-image/Dockerfiles/Dockerfile @@ -5,7 +5,7 @@ FROM registry.access.redhat.com/ubi9/nodejs-18 as builder USER root # assign token for reading packages from github package registry -ARG GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN='' +ARG PACKAGE_REGISTRY_ACCESS_TOKEN='' # install Java RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz -o /tmp/java-package.tar.gz \ @@ -15,9 +15,9 @@ RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar RUN curl -kL https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz -o /tmp/maven-package.tar.gz \ && tar xvzf /tmp/maven-package.tar.gz -C /usr/ -# install go package manager -RUN curl -kL https://go.dev/dl/go1.20.6.linux-amd64.tar.gz -o /tmp/go-package.tar.gz \ - && tar xvzf /tmp/go-package.tar.gz -C /usr/ +# install golang package manager +RUN curl -kL https://go.dev/dl/go1.21.1.linux-amd64.tar.gz -o /tmp/golang-package.tar.gz \ + && tar xvzf /tmp/golang-package.tar.gz -C /usr/ # install python package manager (pip) RUN python3 -m ensurepip --upgrade @@ -25,15 +25,18 @@ RUN python3 -m ensurepip --upgrade # install jq JSON formating tool RUN curl -kL https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -o /usr/bin/jq +# install linux utils Package to enable UUID generation +RUN yum install util-linux + # copy the .npmrc file COPY configs/.npmrc . # replace placeholder with the actual environment variable -RUN sed -i "s/__GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN__/${GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc +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 exhort script -COPY scripts/exhort.sh / +# add RHDA script +COPY scripts/rhda.sh / # assign executable permissions to all installed binaries RUN chmod +x /usr/jdk-20.0.2/bin/java \ @@ -41,19 +44,24 @@ RUN chmod +x /usr/jdk-20.0.2/bin/java \ && chmod +x /usr/go/bin/go \ && chmod +x /usr/local/bin/pip3 \ && chmod +x /usr/bin/jq \ + && chmod +x /usr/bin/uuidgen \ && chmod +x /opt/app-root/src/.npm-global/bin/exhort-javascript-api \ - && chmod +x /exhort.sh + && chmod +x /rhda.sh # use default user USER default -#second stage +# second stage FROM registry.access.redhat.com/ubi9/nodejs-18-minimal LABEL org.opencontainers.image.source https://github.com/RHEcosystemAppEng/exhort-javascript-api # 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='' # Copy java executable from the builder stage COPY --from=builder /usr/jdk-20.0.2/ /usr/jdk-20.0.2/ @@ -65,10 +73,10 @@ ENV MAVEN_HOME=/usr/apache-maven-3.9.4 # Copy golang executable from the builder stage COPY --from=builder /usr/go/ /usr/go/ -ENV GO_HOME=/usr/go +ENV GOLANG_HOME=/usr/go # Update PATH -ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GO_HOME/bin +ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GOLANG_HOME/bin # Copy python executable from the builder stage COPY --from=builder /usr/bin/python3 /usr/bin/python3 @@ -84,8 +92,11 @@ RUN ln -s /usr/bin/python3 /usr/bin/python \ # Copy jq executable from the builder stage COPY --from=builder /usr/bin/jq /usr/bin/jq +# Copy uuidgen executable from the builder stage +COPY --from=builder /usr/bin/uuidgen /usr/bin/uuidgen + # Copy exhort-javascript-api executable from the builder stage COPY --from=builder /opt/app-root/src/.npm-global/ /opt/app-root/src/.npm-global/ -# Copy exhort executable script from the builder stage -COPY --from=builder /exhort.sh /exhort.sh \ No newline at end of file +# Copy RHDA executable script from the builder stage +COPY --from=builder /rhda.sh /rhda.sh \ No newline at end of file diff --git a/docker-image/Dockerfiles/Dockerfile.alpha b/docker-image/Dockerfiles/Dockerfile.alpha index ce47b729..d64bf646 100644 --- a/docker-image/Dockerfiles/Dockerfile.alpha +++ b/docker-image/Dockerfiles/Dockerfile.alpha @@ -5,7 +5,7 @@ FROM registry.access.redhat.com/ubi9/nodejs-18 as builder USER root # assign token for reading packages from github package registry -ARG GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN='' +ARG PACKAGE_REGISTRY_ACCESS_TOKEN='' # install Java RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar.gz -o /tmp/java-package.tar.gz \ @@ -15,36 +15,49 @@ RUN curl -kL https://download.oracle.com/java/20/latest/jdk-20_linux-x64_bin.tar RUN curl -kL https://dlcdn.apache.org/maven/maven-3/3.9.4/binaries/apache-maven-3.9.4-bin.tar.gz -o /tmp/maven-package.tar.gz \ && tar xvzf /tmp/maven-package.tar.gz -C /usr/ +# install golang package manager +RUN curl -kL https://go.dev/dl/go1.21.1.linux-amd64.tar.gz -o /tmp/golang-package.tar.gz \ + && tar xvzf /tmp/golang-package.tar.gz -C /usr/ + # install jq JSON formating tool RUN curl -kL https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 -o /usr/bin/jq +# install linux utils Package to enable UUID generation +RUN yum install util-linux + # copy the .npmrc file COPY configs/.npmrc . # replace placeholder with the actual environment variable -RUN sed -i "s/__GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN__/${GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN}/g" ./.npmrc +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 exhort script -COPY scripts/exhort.sh / +# add RHDA script +COPY scripts/rhda.sh / # assign executable permissions to all installed binaries RUN chmod +x /usr/jdk-20.0.2/bin/java \ && chmod +x /usr/apache-maven-3.9.4/bin/mvn \ + && chmod +x /usr/go/bin/go \ && chmod +x /usr/bin/jq \ + && chmod +x /usr/bin/uuidgen \ && chmod +x /opt/app-root/src/.npm-global/bin/exhort-javascript-api \ - && chmod +x /exhort.sh + && chmod +x /rhda.sh # use default user USER default -#second stage +# second stage FROM registry.access.redhat.com/ubi9/nodejs-18-minimal LABEL org.opencontainers.image.source https://github.com/RHEcosystemAppEng/exhort-javascript-api # 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='' # Copy java executable from the builder stage COPY --from=builder /usr/jdk-20.0.2/ /usr/jdk-20.0.2/ @@ -54,14 +67,21 @@ ENV JAVA_HOME=/usr/jdk-20.0.2 COPY --from=builder /usr/apache-maven-3.9.4/ /usr/apache-maven-3.9.4/ ENV MAVEN_HOME=/usr/apache-maven-3.9.4 +# Copy golang executable from the builder stage +COPY --from=builder /usr/go/ /usr/go/ +ENV GOLANG_HOME=/usr/go + # Update PATH -ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin +ENV PATH=$PATH:$JAVA_HOME/bin:$MAVEN_HOME/bin:$GOLANG_HOME/bin # Copy jq executable from the builder stage COPY --from=builder /usr/bin/jq /usr/bin/jq +# Copy uuidgen executable from the builder stage +COPY --from=builder /usr/bin/uuidgen /usr/bin/uuidgen + # Copy exhort-javascript-api executable from the builder stage COPY --from=builder /opt/app-root/src/.npm-global/ /opt/app-root/src/.npm-global/ -# Copy exhort executable script from the builder stage -COPY --from=builder /exhort.sh /exhort.sh \ No newline at end of file +# Copy RHDA executable script from the builder stage +COPY --from=builder /rhda.sh /rhda.sh \ No newline at end of file diff --git a/docker-image/README.md b/docker-image/README.md index 7b93e4b0..eac343fb 100644 --- a/docker-image/README.md +++ b/docker-image/README.md @@ -13,6 +13,7 @@ Both Docker and Podman are container runtimes that can be used to build and run ## Images generated for Exhort Javascript API -Ecosystem | Version | IMAGE | TAG | -------------- | ------------------------------------------------------------------ | ----------------------------------------------- |-------------------| -Maven & NPM | maven 3.9.4,
npm 9.5.0 | quay.io/ecosystem-appeng/exhort-javascript-api | 1.0-alpha | +Ecosystem | Version | IMAGE | TAG | +----------------------| ------------------------------------------------------------------ | ----------------------------------------------- |-------------------| +Maven & NPM | mvn 3.9.4,
npm 9.5.0 | quay.io/ecosystem-appeng/exhort-javascript-api | 0.7.0-alpha | +Maven, NPM & Golang | mvn 3.9.4,
npm 9.5.0,
go 1.21.1 | quay.io/ecosystem-appeng/exhort-javascript-api | 0.7.3-alpha | diff --git a/docker-image/configs/.npmrc b/docker-image/configs/.npmrc index 0fa63d74..a21fe966 100644 --- a/docker-image/configs/.npmrc +++ b/docker-image/configs/.npmrc @@ -1,2 +1,2 @@ -//npm.pkg.github.com/:_authToken=__GITHUB_PACKAGE_REGISTRY_ACCESS_TOKEN__ +//npm.pkg.github.com/:_authToken=__PACKAGE_REGISTRY_ACCESS_TOKEN__ @RHEcosystemAppEng:registry=https://npm.pkg.github.com \ No newline at end of file diff --git a/docker-image/scripts/exhort.sh b/docker-image/scripts/rhda.sh similarity index 100% rename from docker-image/scripts/exhort.sh rename to docker-image/scripts/rhda.sh