Skip to content

Commit 0631b91

Browse files
authored
Fix image builde errors (#1050)
Signed-off-by: Andy Tael <andy.tael@yahoo.com>
1 parent a6f2277 commit 0631b91

File tree

4 files changed

+67
-6
lines changed

4 files changed

+67
-6
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: 'Process Image'
2+
description: 'Dockerfile, Build, Push Images'
3+
inputs:
4+
src_image:
5+
description: Source Image
6+
required: true
7+
dst_image:
8+
description: Destination Image
9+
required: true
10+
description:
11+
description: Description of Image
12+
required: true
13+
push:
14+
description: Boolean to push image (true) or just build (false)
15+
required: true
16+
pkg_command:
17+
description: Package manager command to run during updates (eg microdnf)
18+
required: false
19+
default: microdnf
20+
runs:
21+
using: "composite"
22+
steps:
23+
- name: Set date and version Tag
24+
shell: bash
25+
run: |
26+
full_dst_image=${{ inputs.dst_image }}
27+
full_dst_tag=${full_dst_image#*:}
28+
now=$(date +'%Y.%m.%d')
29+
echo "date=$now" >> $GITHUB_ENV
30+
echo "date_dst_tag=$full_dst_image-${now//./}" >> $GITHUB_ENV
31+
echo "version_dst_tag=${full_dst_image%:*}:${full_dst_tag%%-*}" >> $GITHUB_ENV
32+
33+
- name: Write Dockerfile
34+
shell: bash
35+
run: |
36+
cat <<- EOF > ${{ runner.temp }}/Dockerfile
37+
FROM ${{ inputs.src_image }}
38+
LABEL org.opencontainers.image.source="https://github.com/${{ github.repository }}"
39+
LABEL org.opencontainers.image.description="${{ inputs.description }}"
40+
LABEL org.opencontainers.image.name="${{ inputs.dst_image }}"
41+
LABEL org.opencontainers.image.version="${{ env.date }}"
42+
RUN (${{ inputs.pkg_command }} update --refresh --nodocs --best -y || ${{ inputs.pkg_command }} update --refresh --nodocs --nobest -y) && ${{ inputs.pkg_command }} clean all
43+
#RUN echo "Testing Update Functionality" > /image_digest
44+
RUN rpm -qa | sort | sha256sum | awk '{print $1}' > /image_digest
45+
EOF
46+
47+
- name: Build Image
48+
uses: docker/build-push-action@v5
49+
if: ${{ inputs.push == 'false' }}
50+
with:
51+
context: "${{ runner.temp }}"
52+
push: false
53+
tags: ${{ env.version_dst_tag }}
54+
55+
- name: Build and Push Image
56+
uses: docker/build-push-action@v5
57+
if: ${{ inputs.push == 'true' }}
58+
with:
59+
context: "${{ runner.temp }}"
60+
push: true
61+
tags: ${{ env.version_dst_tag }},${{ env.date_dst_tag }}

.github/workflows/obaas-base-image.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ jobs:
3737

3838
- name: Create New Image
3939
if: env.latest_digest == ''
40-
uses: ./.github/actions/process-image
40+
uses: ./.github/actions/process-image/action-base.yml
4141
with:
4242
src_image: container-registry.oracle.com/graalvm/native-image:${{ matrix.base_version }}-${{ env.src_tag_suffix }}
4343
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}-${{ env.src_tag_suffix }}
@@ -60,7 +60,7 @@ jobs:
6060
- name: Update Existing Image
6161
id: update_image
6262
if: env.latest_digest != '' && steps.trivy_scan.outcome == 'failure'
63-
uses: ./.github/actions/process-image
63+
uses: ./.github/actions/process-image/action-base.yml
6464
with:
6565
src_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}
6666
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}-${{ env.src_tag_suffix }}
@@ -77,7 +77,7 @@ jobs:
7777
7878
- name: Push Updated Image
7979
if: steps.get_newest_digest.outcome != 'skipped' && env.latest_digest != env.newest_digest
80-
uses: ./.github/actions/process-image
80+
uses: ./.github/actions/process-image/action-base.yml
8181
with:
8282
src_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}
8383
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}-${{ env.src_tag_suffix }}

.github/workflows/openjdk-base-image.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636

3737
- name: Create New Image
3838
if: env.latest_digest == ''
39-
uses: ./.github/actions/process-image
39+
uses: ./.github/actions/process-image/action-openjdk.yml
4040
with:
4141
src_image: container-registry.oracle.com/java/openjdk:${{ matrix.base_version }}
4242
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}
@@ -60,7 +60,7 @@ jobs:
6060
- name: Update Existing Image
6161
id: update_image
6262
if: env.latest_digest != '' && steps.trivy_scan.outcome == 'failure'
63-
uses: ./.github/actions/process-image
63+
uses: ./.github/actions/process-image/action-openjdk.yml
6464
with:
6565
src_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}
6666
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}
@@ -78,7 +78,7 @@ jobs:
7878
7979
- name: Push Updated Image
8080
if: steps.get_newest_digest.outcome != 'skipped' && env.latest_digest != env.newest_digest
81-
uses: ./.github/actions/process-image
81+
uses: ./.github/actions/process-image/action-openjdk.yml
8282
with:
8383
src_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}
8484
dst_image: ghcr.io/${{ github.repository_owner }}/${{ env.dst_img }}:${{ matrix.base_version }}

0 commit comments

Comments
 (0)