Skip to content

Commit

Permalink
feat: add java image
Browse files Browse the repository at this point in the history
  • Loading branch information
jigarkhwar committed Sep 7, 2024
1 parent ebe02a3 commit dc9034e
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ jobs:
/kaniko/executor --dockerfile="Dockerfile" \
--context="${{ github.repositoryUrl }}#${{ github.ref }}#${{ github.sha }}" \
--destination="$DOCKER_IMAGE_NAME:master" \
--destination="$DOCKER_IMAGE_NAME:${GITHUB_REF##*/}" \
--destination="$DOCKER_IMAGE_NAME:latest" \
${{ env.KANIKO_CACHE_ARGS }} \
--push-retry 5
Expand Down
49 changes: 42 additions & 7 deletions .github/workflows/pull-request-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,40 @@ on:
pull_request:
branches: [ '**' ]

env:
KANIKO_CACHE_ARGS: "--cache=true --cache-repo galaxioteam/base-cache --cache-copy-layers=true --cache-ttl=24h"

jobs:
test-base-build:
base-build:
runs-on: ubuntu-22.04
container:
image: gcr.io/kaniko-project/executor:v1.20.0-debug
permissions:
contents: read # read the repository
needs: test-build
steps:
- name: Test Base Build with kaniko
- 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 }}" \
--cleanup \
--no-push
test-java-build:
--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 ]
Expand All @@ -30,10 +49,26 @@ jobs:
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 \
--no-push
--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"
3 changes: 2 additions & 1 deletion java.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
ARG JAVA_VERSION=21
ARG BASE_VERSION=master

FROM eclipse-temurin:${JAVA_VERSION}-jdk-jammy as fat

LABEL maintainer="Galaxio Team"
LABEL authors="i.akhaltsev"

FROM galaxioteam/base:master
FROM galaxioteam/base:${BASE_VERSION}

COPY --from=fat /opt/java/openjdk/ /opt/java/openjdk/

Expand Down

0 comments on commit dc9034e

Please sign in to comment.