Configures Enterprise Edition image to automatically start with enterprise features enabled (#1084)

* Makes EE be separately built and pushed
* Adds parameterisation to docker_latest.yml to simplify testing
pull/1091/head
Spoffy 2 months ago committed by GitHub
parent 6908807236
commit 90a9291e0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -11,11 +11,36 @@ on:
- cron: '41 5 * * *'
workflow_dispatch:
inputs:
latest_branch:
branch:
description: "Branch from which to create the latest Docker image (default: latest_candidate)"
type: string
required: true
default_value: latest_candidate
default: latest_candidate
disable_tests:
description: "Should the tests be skipped?"
type: boolean
required: True
default: False
platforms:
description: "Platforms to build"
type: choice
required: True
options:
- linux/amd64
- linux/arm64/v8
- linux/amd64,linux/arm64/v8
default: linux/amd64,linux/arm64/v8
tag:
description: "Tag for the resulting images"
type: string
required: True
default: 'experimental'
env:
BRANCH: ${{ inputs.branch || 'latest_candidate' }}
PLATFORMS: ${{ inputs.platforms || 'linux/amd64,linux/arm64/v8' }}
TAG: ${{ inputs.tag || 'experimental' }}
DOCKER_HUB_OWNER: ${{ vars.DOCKER_HUB_OWNER || github.repository_owner }}
jobs:
push_to_registry:
@ -32,21 +57,23 @@ jobs:
repo: "grist-core"
- name: "grist"
repo: "grist-ee"
# For now, we build it twice, with `grist-ee` being a
# backwards-compatible synonym for `grist`.
- name: "grist-ee"
repo: "grist-ee"
steps:
- name: Build settings
run: |
echo "Branch: $BRANCH"
echo "Platforms: $PLATFORMS"
echo "Docker Hub Owner: $DOCKER_HUB_OWNER"
echo "Tag: $TAG"
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ inputs.latest_branch }}
ref: ${{ env.BRANCH }}
- name: Check out the ext/ directory
if: matrix.image.name != 'grist-oss'
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
@ -58,38 +85,44 @@ jobs:
with:
context: .
load: true
tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }}
cache-from: type=gha
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}
- name: Use Node.js ${{ matrix.node-version }} for testing
if: ${{ !inputs.disable_tests }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed
if: ${{ !inputs.disable_tests }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install Python packages
if: ${{ !inputs.disable_tests }}
run: |
pip install virtualenv
yarn run install:python
- name: Install Node.js packages
if: ${{ !inputs.disable_tests }}
run: yarn install
- name: Build Node.js code
if: ${{ !inputs.disable_tests }}
run: |
rm -rf ext
yarn run build:prod
- name: Run tests
run: TEST_IMAGE=${{ github.repository_owner }}/${{ matrix.image.name }}:experimental VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker
if: ${{ !inputs.disable_tests }}
run: TEST_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }} VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker
- name: Restore the ext/ directory
if: matrix.image.name != 'grist-oss'
if: ${{ matrix.image.name != 'grist-oss' && !inputs.disable_tests }}
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}
- name: Log in to Docker Hub
@ -102,13 +135,28 @@ jobs:
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64/v8
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
tags: ${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name }}:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}
- name: Push Enterprise to Docker Hub
if: ${{ matrix.image.name == 'grist' }}
uses: docker/build-push-action@v2
with:
context: .
build-args: |
BASE_IMAGE=${{ env.DOCKER_HUB_OWNER }}/${{ matrix.image.name}}
BASE_VERSION=${{ env.TAG }}
file: ext/Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
tags: ${{ env.DOCKER_HUB_OWNER }}/grist-ee:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
update_latest_branch:
name: Update latest branch
runs-on: ubuntu-latest

Loading…
Cancel
Save