Skip to content

Commit

Permalink
Docker builders (#62)
Browse files Browse the repository at this point in the history
* docker-builders:  Docker builder updates for ghcr

* docker-builders:  Fix setup

* docker-builders:  Fix docker image references

* docker-builders:  Fix workflow

* docker-builders:  Fix push script

* docker-builders:  Update parent to 1.2.0

* docker-builders:  Add docker logout

* docker-builders:  Use GITHUB_PACKAGE_TOKEN

* docker-builders:  Login at top of script

* docker-builders:  Fix secret name
  • Loading branch information
brianwyka authored Jan 6, 2022
1 parent 072cb4e commit 1dc35ee
Show file tree
Hide file tree
Showing 11 changed files with 134 additions and 74 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build-and-push-docker-builders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ jobs:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.ref }}
- name: Build and Push Docker Images to Bintray
- name: Build and Push Docker Images to Github Container Registry
shell: bash
run: ./distributions/scripts/build-and-push-docker-builders-to-bintray.sh
run: ./distributions/scripts/build-and-push-docker-builders.sh
env:
BINTRAY_USERNAME: ${{ secrets.BINTRAY_USERNAME }}
BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }}
DOCKER_USERNAME: ${{ secrets.GIT_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.GIT_PACKAGE_TOKEN }}
12 changes: 6 additions & 6 deletions .github/workflows/maven-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
java: ['8', '11']
java: ['8', '11', '17']
steps:
- uses: actions/checkout@v2
- uses: actions/cache@v1
Expand Down Expand Up @@ -140,7 +140,7 @@ jobs:
- name: Setup GraalVM
uses: DeLaGuardo/setup-graalvm@master
with:
graalvm-version: 20.3.0.java8
graalvm-version: 21.2.0.java8
- name: Setup GraalVM Native Image Tool
run: gu install native-image
- name: Build Mac Native Image
Expand Down Expand Up @@ -182,18 +182,18 @@ jobs:
run: ren *.jar native-image.jar
- name: Setup GraalVM Native Image and Visual C Build Tools
run: |
Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.3.0/graalvm-ce-java11-windows-amd64-20.3.0.zip -OutFile 'graal.zip'
Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/graalvm-ce-java11-windows-amd64-21.3.0.zip -OutFile 'graal.zip'
Expand-Archive -path 'graal.zip' -destinationpath '.'
graalvm-ce-java11-20.3.0\bin\gu.cmd install native-image
graalvm-ce-java11-21.3.0\bin\gu.cmd install native-image
choco install visualstudio2017-workload-vctools
- name: Build Windows Native Image
if: success()
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
graalvm-ce-java11-20.3.0\bin\native-image -cp .\build\native-image.jar -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime
graalvm-ce-java11-21.3.0\bin\native-image -cp .\build\native-image.jar -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime
env:
JAVA_HOME: ./graalvm-ce-java11-20.3.0
JAVA_HOME: ./graalvm-ce-java11-21.3.0
- name: Archive Windows Native Image
if: success()
continue-on-error: true
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -154,16 +154,16 @@ jobs:
asset_path: ./distributions/rpm/target/sourcehawk-centos-8.rpm
asset_name: sourcehawk-${{ steps.set_maven_project_version.outputs.RELEASE_VERSION }}-1.el8.x86_64.rpm
asset_content_type: application/octet-stream
- name: Upload Sourcehawk Fedora 34 RPM Package
- name: Upload Sourcehawk Fedora 35 RPM Package
if: success()
continue-on-error: true
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./distributions/rpm/target/sourcehawk-fedora-34.rpm
asset_name: sourcehawk-${{ steps.set_maven_project_version.outputs.RELEASE_VERSION }}-1.fc34.x86_64.rpm
asset_path: ./distributions/rpm/target/sourcehawk-fedora-35.rpm
asset_name: sourcehawk-${{ steps.set_maven_project_version.outputs.RELEASE_VERSION }}-1.fc35.x86_64.rpm
asset_content_type: application/octet-stream
- name: Publish Github Pages
if: success()
Expand Down Expand Up @@ -228,7 +228,7 @@ jobs:
- name: Setup GraalVM
uses: DeLaGuardo/setup-graalvm@master
with:
graalvm-version: 20.3.0.java8
graalvm-version: 21.2.0.java8
- name: Setup GraalVM Native Image Tool
run: gu install native-image
- name: Build Mac Native Image
Expand Down Expand Up @@ -291,18 +291,18 @@ jobs:
run: ren *.jar native-image.jar
- name: Setup GraalVM Native Image and Visual C Build Tools
run: |
Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-20.3.0/graalvm-ce-java11-windows-amd64-20.3.0.zip -OutFile 'graal.zip'
Invoke-RestMethod -Uri https://github.com/graalvm/graalvm-ce-builds/releases/download/vm-21.3.0/graalvm-ce-java11-windows-amd64-21.3.0.zip -OutFile 'graal.zip'
Expand-Archive -path 'graal.zip' -destinationpath '.'
graalvm-ce-java11-20.3.0\bin\gu.cmd install native-image
graalvm-ce-java11-21.3.0\bin\gu.cmd install native-image
choco install visualstudio2017-workload-vctools
- name: Build Windows Native Image
if: success()
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvars64.bat"
graalvm-ce-java11-20.3.0\bin\native-image -cp .\build\native-image.jar -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime
graalvm-ce-java11-21.3.0\bin\native-image -cp .\build\native-image.jar -H:+ReportExceptionStackTraces --report-unsupported-elements-at-runtime
env:
JAVA_HOME: ./graalvm-ce-java11-20.3.0
JAVA_HOME: ./graalvm-ce-java11-21.3.0
- name: Smoke Test
if: success()
shell: cmd
Expand Down
2 changes: 1 addition & 1 deletion distributions/docker-builders/Dockerfile-nativeimage
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Oracle GraalVM Java 8 Base Container
ARG FROM=oracle/graalvm-ce:20.3.0-java8
ARG FROM=ghcr.io/graalvm/graalvm-ce:java8-21.2.0
FROM ${FROM}

# Install native-image tool
Expand Down
4 changes: 2 additions & 2 deletions distributions/linux/native-image-builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG GRAALVM_VERSION=20.3.0-java8
FROM optum-docker-builders.bintray.io/nativeimage:graalvm-ce-${GRAALVM_VERSION}
ARG GRAALVM_VERSION=21.3.0-java8
FROM ghcr.io/optum/sourcehawk-ci/nativeimage:graalvm-ce-${GRAALVM_VERSION}

# Build Arguments
ARG NAME
Expand Down
15 changes: 13 additions & 2 deletions distributions/linux/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
<jdk>8</jdk>
</activation>
<properties>
<graalvm.version>20.3.0-java8</graalvm.version>
<graalvm.version>21.3.0-java8</graalvm.version>
</properties>
</profile>

Expand All @@ -247,7 +247,18 @@
<jdk>11</jdk>
</activation>
<properties>
<graalvm.version>20.3.0-java11</graalvm.version>
<graalvm.version>21.3.0-java11</graalvm.version>
</properties>
</profile>

<!-- JAVA 17 NATIVE IMAGE BUILD -->
<profile>
<id>native-image-build-java17</id>
<activation>
<jdk>11</jdk>
</activation>
<properties>
<graalvm.version>21.3.0-java17</graalvm.version>
</properties>
</profile>

Expand Down
2 changes: 1 addition & 1 deletion distributions/rpm/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG FROM_TAG=centos7
FROM optum-docker-builders.bintray.io/rpmbuild:${FROM_TAG}
FROM ghcr.io/optum/sourcehawk-ci/rpmbuild:${FROM_TAG}

# Build Arguments
ARG RPM_BUILD_DIRECTORY
Expand Down
52 changes: 52 additions & 0 deletions distributions/rpm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,23 @@
<skipDockerInfo>true</skipDockerInfo>
</configuration>
</execution>
<execution>
<id>build-and-tag-fedora-35</id>
<phase>prepare-package</phase>
<goals>
<goal>build</goal>
<goal>tag</goal>
</goals>
<configuration>
<repository>${project.artifactId}-builder-fedora-35</repository>
<tag>${project.version}</tag>
<buildArgs>
<FROM_TAG>fedora35</FROM_TAG>
<RPM_FILE>/tmp/${rpm.package}-fedora-35.rpm</RPM_FILE>
</buildArgs>
<skipDockerInfo>true</skipDockerInfo>
</configuration>
</execution>
</executions>
</plugin>

Expand Down Expand Up @@ -342,6 +359,21 @@
</arguments>
</configuration>
</execution>
<execution>
<id>extract-fedora-35-package</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${project.parent.basedir}/scripts/extract-file-from-docker-container.sh</executable>
<arguments>
<argument>${project.artifactId}-builder-fedora-35:${project.version}</argument>
<argument>/tmp/${rpm.package}-fedora-35.rpm</argument>
<argument>${project.build.directory}</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>

Expand Down Expand Up @@ -396,6 +428,11 @@
<classifier>fc34.${rpm.package.architecture}</classifier>
<type>rpm</type>
</artifact>
<artifact>
<file>${project.build.directory}/${rpm.package}-fedora-35.rpm</file>
<classifier>fc35.${rpm.package.architecture}</classifier>
<type>rpm</type>
</artifact>
</artifacts>
</configuration>
</execution>
Expand Down Expand Up @@ -535,6 +572,21 @@
</environmentVariables>
</configuration>
</execution>
<execution>
<id>publish-fedora-35-package</id>
<goals>
<goal>exec</goal>
</goals>
<phase>deploy</phase>
<configuration>
<executable>${project.basedir}/scripts/publish-package-version-to-bintray.sh</executable>
<environmentVariables combine.children="append">
<PACKAGE_FILE_PATH>${project.build.directory}/${rpm.package}-fedora-35.rpm</PACKAGE_FILE_PATH>
<BINTRAY_REPOSITORY>fedora</BINTRAY_REPOSITORY>
<BINTRAY_DISTRIBUTION>fc35</BINTRAY_DISTRIBUTION>
</environmentVariables>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
Expand Down
49 changes: 0 additions & 49 deletions distributions/scripts/build-and-push-docker-builders-to-bintray.sh

This file was deleted.

46 changes: 46 additions & 0 deletions distributions/scripts/build-and-push-docker-builders.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/bin/bash

##############################################################################################################
#
# Push Docker Builders to Remote Registry
#
##############################################################################################################

set -e

ROOT_DIR="$( cd "$( dirname "$( dirname "$( dirname "${BASH_SOURCE[0]}" )")")" && pwd )"
DOCKER_BUILDERS_DIR="$ROOT_DIR/distributions/docker-builders"

# Variables
DOCKER_ORG="optum/ci"
REGISTRY="ghcr.io"

# Login to Registry
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin $REGISTRY

# Native Image
docker build -t $REGISTRY/$DOCKER_ORG/nativeimage:graalvm-ce-21.2.0-java8 -f "$DOCKER_BUILDERS_DIR/Dockerfile-nativeimage" --build-arg FROM=ghcr.io/graalvm/graalvm-ce:java8-21.2.0 .
docker build -t $REGISTRY/$DOCKER_ORG/nativeimage:graalvm-ce-21.3.0-java11 -f "$DOCKER_BUILDERS_DIR/Dockerfile-nativeimage" --build-arg FROM=ghcr.io/graalvm/graalvm-ce:java11-21.3.0 .
docker build -t $REGISTRY/$DOCKER_ORG/nativeimage:graalvm-ce-21.3.0-java17 -f "$DOCKER_BUILDERS_DIR/Dockerfile-nativeimage" --build-arg FROM=ghcr.io/graalvm/graalvm-ce:java17-21.3.0 .

# RPM Build
docker build -t $REGISTRY/$DOCKER_ORG/rpmbuild:centos7 -f "$DOCKER_BUILDERS_DIR/Dockerfile-rpmbuild" --build-arg FROM=centos:7 .
docker build -t $REGISTRY/$DOCKER_ORG/rpmbuild:centos8 -f "$DOCKER_BUILDERS_DIR/Dockerfile-rpmbuild" --build-arg FROM=centos:8 .
docker build -t $REGISTRY/$DOCKER_ORG/rpmbuild:fedora32 -f "$DOCKER_BUILDERS_DIR/Dockerfile-rpmbuild" --build-arg FROM=fedora:32 .
docker build -t $REGISTRY/$DOCKER_ORG/rpmbuild:fedora33 -f "$DOCKER_BUILDERS_DIR/Dockerfile-rpmbuild" --build-arg FROM=fedora:33 .
docker build -t $REGISTRY/$DOCKER_ORG/rpmbuild:fedora34 -f "$DOCKER_BUILDERS_DIR/Dockerfile-rpmbuild" --build-arg FROM=fedora:34 .
docker build -t $REGISTRY/$DOCKER_ORG/rpmbuild:fedora35 -f "$DOCKER_BUILDERS_DIR/Dockerfile-rpmbuild" --build-arg FROM=fedora:35 .

# Push All Builders to Remote Registry
docker push $REGISTRY/$DOCKER_ORG/nativeimage:graalvm-ce-21.2.0-java8
docker push $REGISTRY/$DOCKER_ORG/nativeimage:graalvm-ce-21.3.0-java11
docker push $REGISTRY/$DOCKER_ORG/nativeimage:graalvm-ce-21.3.0-java17
docker push $REGISTRY/$DOCKER_ORG/rpmbuild:centos7
docker push $REGISTRY/$DOCKER_ORG/rpmbuild:centos8
docker push $REGISTRY/$DOCKER_ORG/rpmbuild:fedora32
docker push $REGISTRY/$DOCKER_ORG/rpmbuild:fedora33
docker push $REGISTRY/$DOCKER_ORG/rpmbuild:fedora34
docker push $REGISTRY/$DOCKER_ORG/rpmbuild:fedora35

# Log out of registry
docker logout $REGISTRY
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>com.optum.sourcehawk</groupId>
<artifactId>sourcehawk-jar-parent</artifactId>
<version>1.1.10</version>
<version>1.2.0</version>
<relativePath/>
</parent>

Expand Down

0 comments on commit 1dc35ee

Please sign in to comment.