This repository was archived by the owner on Jun 5, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 91
82 lines (79 loc) · 3.14 KB
/
image-build.yml
File metadata and controls
82 lines (79 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
# This workflow build (but does not push) the OCI image
name: OCI Image - Build
on:
workflow_call:
inputs:
artifact-name:
description: 'The name of the artifact to upload'
required: true
type: string
platform:
description: 'The platform to build the image for'
required: true
type: string
permissions:
contents: read
jobs:
docker-image:
name: Check docker image build
runs-on: ${{ inputs.platform == 'linux/arm64' && 'ubuntu-24.04-arm' || 'ubuntu-latest' }}
env:
IMAGE_NAME: stacklok/codegate
IMAGE_TAG: dev
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up QEMU for cross-platform builds
# Only set up QEMU if the platform is not linux/amd64
if: ${{ inputs.platform != 'linux/amd64' }}
uses: docker/setup-qemu-action@29109295f81e9208d7d86ff1c6c12d2833863392 # v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2 # v3
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@07ab29fd4a977ae4d2b275087cf67563dfdf0295 # v9
with:
github_token: ${{ github.token }}
workflow: ".github/workflows/import_packages.yml"
workflow_conclusion: success
name: sqlite_data
name_is_regexp: true
skip_unpack: false
if_no_artifact_found: ignore
- name: Fetch latest release URL
id: fetch_release_url
run: |
echo "LATEST_RELEASE=$(curl -s "https://api.github.com/repos/stacklok/codegate-ui/releases/latest" | jq -r '.zipball_url')" >> $GITHUB_ENV
- name: Download git lfs dependencies
run: |
git lfs install
git lfs pull
- name: Test build - ${{ inputs.platform }}
id: docker_build
uses: docker/build-push-action@14487ce63c7a62a4a324b0bfb37086795e31c6c1 # v5
with:
context: .
file: ./Dockerfile
platforms: ${{ inputs.platform }}
push: false # Only attempt to build, to verify the Dockerfile is working
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
LATEST_RELEASE=${{ env.LATEST_RELEASE }}
tags: ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Save Docker image as a tarball
# Only save the image if the build was for linux/amd64, as we only need it for the integration tests
if: ${{ inputs.platform == 'linux/amd64' }}
run: |
# List all images
docker images
# Save the image as a tarball
docker save -o image.tar ${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}
- name: Upload Docker image artifact
# Only upload the image if the build was for linux/amd64, as we only need it for the integration tests
if: ${{ inputs.platform == 'linux/amd64' }}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: ${{ inputs.artifact-name }}
path: image.tar