-
Notifications
You must be signed in to change notification settings - Fork 35
70 lines (67 loc) · 2.36 KB
/
image-build.yml
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
# 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
permissions:
contents: read
jobs:
docker-image:
name: Check docker image build
runs-on: ubuntu-latest
env:
IMAGE_NAME: stacklok/codegate
IMAGE_TAG: dev
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@20319c5641d495c8a52e688b7dc5fada6c3a9fbc # v8
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 on x86
id: docker_build
uses: docker/build-push-action@ca877d9245402d1537745e0e356eab47c3520991 # v5
with:
context: .
file: ./Dockerfile
platforms: linux/amd64
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
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
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4
with:
name: ${{ inputs.artifact-name }}
path: image.tar