Skip to content

feat: add java image #15

feat: add java image

feat: add java image #15

name: Galaxio Docker Images Building
on:
pull_request:
branches: [ '**' ]
env:
KANIKO_CACHE_ARGS: "--cache=true --cache-repo galaxioteam/base-cache --cache-copy-layers=true --cache-ttl=24h"
jobs:
base-build:
runs-on: ubuntu-22.04
container:
image: gcr.io/kaniko-project/executor:v1.20.0-debug
permissions:
contents: read # read the repository
steps:
- name: Build and Push Image to docker registry with kaniko
run: |
cat <<EOF > /kaniko/.docker/config.json
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "$(echo -n "${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}" | base64 )"
}
}
}
EOF
/kaniko/executor --dockerfile="Dockerfile" \
--context="${{ github.repositoryUrl }}#${{ github.head_ref }}" \
--destination="$DOCKER_IMAGE_NAME:${GITHUB_SHA}" \
${{ env.KANIKO_CACHE_ARGS }} \
--push-retry 5
env:
GIT_USERNAME: ${{ github.actor }}
GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_IMAGE_NAME: "galaxioteam/base"
java-build:
strategy:
matrix:
java-version: [ 17, 21 ]
runs-on: ubuntu-22.04
container:
image: gcr.io/kaniko-project/executor:v1.20.0-debug
needs: base-build
permissions:
contents: read # read the repository
steps:
- name: Test Java Build with kaniko
run: |
cat <<EOF > /kaniko/.docker/config.json
{
"auths": {
"https://index.docker.io/v1/": {
"auth": "$(echo -n "${{ secrets.DOCKER_USERNAME }}:${{ secrets.DOCKER_PASSWORD }}" | base64 )"
}
}
}
EOF
export IFS=''
/kaniko/executor --dockerfile="java.Dockerfile" \
--context="${{ github.repositoryUrl }}#${{ github.head_ref }}" \
--build-arg "BASE_VERSION=${GITHUB_SHA}" \
--build-arg "JAVA_VERSION=${{ matrix.java-version }}" \
--cleanup \
--destination="$DOCKER_IMAGE_NAME:${{ matrix.java-version }}-${GITHUB_SHA}" \
${{ env.KANIKO_CACHE_ARGS }} \
--push-retry 5
env:
GIT_USERNAME: ${{ github.actor }}
GIT_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_IMAGE_NAME: "galaxioteam/base-jdk"