-
Notifications
You must be signed in to change notification settings - Fork 241
72 lines (62 loc) · 2.2 KB
/
build_docker_builder.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
71
72
name: Build Docker image for building PGlite
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
on:
workflow_dispatch:
inputs:
message:
description: 'Build PGlite builder Docker image'
push:
branches: ['main']
pull_request:
env:
DOCKERHUB_REPO: electricsql
IMAGE_NAME: pglite-builder
jobs:
build:
name: Build Docker image
runs-on: ubuntu-22.04
environment: PGlite Build Parameters
env:
PG_VERSION: ${{ vars.PG_VERSION }}
SDK_VERSION: ${{ vars.PYTHON_WASM_SDK_VERSION }}
steps:
- name: Log build parameters
run: |
echo "Building with PG_VERSION=${PG_VERSION} and SDK_VERSION=${SDK_VERSION}"
- name: Set image name and tag
id: set-image-name
run: |
echo "IMGNAME=${{ env.DOCKERHUB_REPO }}/${{ env.IMAGE_NAME }}" >> $GITHUB_ENV
echo "IMGTAG=${{ env.PG_VERSION }}_${{ env.SDK_VERSION }}" >> $GITHUB_ENV
- name: Check if image exists
id: image-exists
run: |
if docker manifest inspect ${{ env.DOCKERHUB_REPO }}/${{ env.IMAGE_NAME }}:${{ env.PG_VERSION }}-${{ env.SDK_VERSION }} > /dev/null 2>&1; then
echo "exists=true" >> $GITHUB_ENV
echo "::set-output name=exists::true"
else
echo "exists=false" >> $GITHUB_ENV
echo "::set-output name=exists::false"
fi
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
if: steps.image-exists.outputs.exists == 'false'
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
if: steps.image-exists.outputs.exists == 'false'
- uses: actions/checkout@v4
if: steps.image-exists.outputs.exists == 'false'
- name: Build and push
uses: docker/build-push-action@v6
if: steps.image-exists.outputs.exists == 'false'
with:
platforms: linux/amd64,linux/arm64
push: true
build-args: |
PG_VERSION=${PG_VERSION}
SDK_VERSION=${SDK_VERSION}
tags: |
${PGLITE_BUILDER_IMAGE_NAME}:${BUILDER_VERSION}
${PGLITE_BUILDER_IMAGE_NAME}:latest