Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reorganize grist docker images and workflows #988

Merged
merged 6 commits into from
Jun 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 27 additions & 4 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,35 @@ on:

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
name: Push Docker images to Docker Hub
runs-on: ubuntu-latest
strategy:
matrix:
image:
# We build two images, `grist-oss` and `grist`.
# See https://github.com/gristlabs/grist-core?tab=readme-ov-file#available-docker-images
- name: "grist-oss"
repo: "grist-core"
- name: "grist"
repo: "grist-ee"
# For now, we build it twice, with `grist-ee` being a
# backwards-compatible synoym for `grist`.
- name: "grist-ee"
repo: "grist-ee"
steps:
- name: Check out the repo
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Check out the ext/ directory
if: matrix.image.name != 'grist-oss'
run: buildtools/checkout-ext-directory.sh ${{ matrix.image.repo }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v4
with:
images: |
${{ github.repository_owner }}/grist
${{ github.repository_owner }}/${{ matrix.image.name }}
tags: |
type=ref,event=branch
type=ref,event=pr
Expand All @@ -28,13 +46,16 @@ jobs:
stable
- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
Expand All @@ -44,3 +65,5 @@ jobs:
tags: ${{ steps.meta.outputs.tags }}
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}

50 changes: 45 additions & 5 deletions .github/workflows/docker_latest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ on:
# Run at 5:41 UTC daily
- cron: '41 5 * * *'
workflow_dispatch:
inputs:
latest_branch:
description: Branch from which to create the latest Docker image (default: latest_candidate)
type: string
required: true
default_value: latest_candidate

jobs:
push_to_registry:
Expand All @@ -19,54 +25,88 @@ jobs:
matrix:
python-version: [3.9]
node-version: [18.x]
image:
# We build two images, `grist-oss` and `grist`.
# See https://github.com/gristlabs/grist-core?tab=readme-ov-file#available-docker-images
- name: "grist-oss"
repo: "grist-core"
- name: "grist"
repo: "grist-ee"
# For now, we build it twice, with `grist-ee` being a
# backwards-compatible synoym for `grist`.
- name: "grist-ee"
repo: "grist-ee"
steps:
- name: Check out the repo
uses: actions/checkout@v2
with:
ref: latest_candidate
ref: ${{ inputs.latest_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

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Prepare image but do not push it yet
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: ${{ github.repository_owner }}/grist:latest
tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
cache-from: type=gha
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}

- name: Use Node.js ${{ matrix.node-version }} for testing
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Set up Python ${{ matrix.python-version }} for testing - maybe not needed
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install Python packages
run: |
pip install virtualenv
yarn run install:python

- name: Install Node.js packages
run: yarn install

- name: Build Node.js code
run: yarn run build:prod
run: |
pushd ext && \
{ if [ -e package.json ] ; then yarn install --frozen-lockfile --modules-folder=../../node_modules; fi } && \
popd
yarn run build:prod

- name: Run tests
run: TEST_IMAGE=${{ github.repository_owner }}/grist VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker
run: TEST_IMAGE=${{ github.repository_owner }}/${{ matrix.image.name }} VERBOSE=1 DEBUG=1 MOCHA_WEBDRIVER_HEADLESS=1 yarn run test:docker

- name: Log in to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Push to Docker Hub
uses: docker/build-push-action@v2
with:
context: .
platforms: linux/amd64,linux/arm64/v8
push: true
tags: ${{ github.repository_owner }}/grist:latest
tags: ${{ github.repository_owner }}/${{ matrix.image.name }}:experimental
cache-from: type=gha
cache-to: type=gha,mode=max
build-contexts: ${{ matrix.image.name != 'grist-oss' && 'ext=ext' || '' }}

- name: Update latest branch
uses: ad-m/github-push-action@8407731efefc0d8f72af254c74276b7a90be36e1
with:
Expand Down
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ If you just want a quick demo of Grist:
* Or you can see a fully in-browser build of Grist at [gristlabs.github.io/grist-static](https://gristlabs.github.io/grist-static/).
* Or you can download Grist as a desktop app from [github.com/gristlabs/grist-desktop](https://github.com/gristlabs/grist-desktop).

To get `grist-core` running on your computer with [Docker](https://www.docker.com/get-started), do:
To get the default version of `grist-core` running on your computer
with [Docker](https://www.docker.com/get-started), do:

```sh
docker pull gristlabs/grist
Expand Down Expand Up @@ -117,6 +118,22 @@ You can find a lot more about configuring Grist, setting up authentication,
and running it on a public server in our
[Self-Managed Grist](https://support.getgrist.com/self-managed/) handbook.

## Available Docker images

The default Docker image is `gristlabs/grist`. This contains all of
the standard Grist functionality, as well as extra source-available
code for enterprise customers taken from the the
[grist-ee](https://github.com/gristlabs/grist-ee) repository. This
extra code is not under a free or open source license. By default,
however, the code from the `grist-ee` repository is completely inert and
inactive. This code becomes active only when an administrator enables
it by setting either `GRIST_ACTIVATION` or `GRIST_ACTIVATION_FILE`.

If you would rather use an image that contains exclusively free and
open source code, the `gristlabs/grist-oss` Docker image is available
for this purpose. It is by default functionally equivalent to the
`gristlabs/grist` image.

## The administrator panel

You can turn on a special admininistrator panel to inspect the status
Expand Down
1 change: 1 addition & 0 deletions buildtools/.grist-ee-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.9.2
4 changes: 4 additions & 0 deletions buildtools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@ set -e
PROJECT=""
if [[ -e ext/app ]]; then
PROJECT="tsconfig-ext.json"
echo "Using extra app directory"
else
echo "No extra app directory found"
fi

WEBPACK_CONFIG=buildtools/webpack.config.js
if [[ -e ext/buildtools/webpack.config.js ]]; then
# Allow webpack config file to be replaced (useful
Expand Down
18 changes: 18 additions & 0 deletions buildtools/checkout-ext-directory.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env bash

# This checks out the ext/ directory from the extra repo (e.g.
# grist-ee or grist-desktop) depending on the supplied repo name.

set -e

repo=$1
dir=$(dirname $0)
ref=$(cat $dir/.$repo-version)

git clone --branch $ref --depth 1 --filter=tree:0 "https://github.com/gristlabs/$repo"
pushd $repo
git sparse-checkout set ext
git checkout
popd
mv $repo/ext .
rm -rf $repo
3 changes: 3 additions & 0 deletions tsconfig-ext.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"files": [],
"include": [],
"references": [
{ "path": "./app" },
{ "path": "./stubs/app" },
{ "path": "./test" },
{ "path": "./ext/app" }
],
}
Loading