Skip to content

Commit

Permalink
Update release process to use create-docker-context for smaller image…
Browse files Browse the repository at this point in the history
…s and faster buildx builds
  • Loading branch information
tephenavies committed May 10, 2024
1 parent c4398ad commit 639ddf2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 11 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ on:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
NODE_VERSION: 18

permissions:
packages: write
Expand All @@ -18,32 +19,43 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- name: Install dependencies
run: yarn install --frozen-lockfile
env:
NODE_OPTIONS: "--max_old_space_size=4096"

- name: Build TerriaMap
run: yarn gulp lint release
env:
NODE_OPTIONS: "--max_old_space_size=4096"

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

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

- name: Login to GHCR
uses: docker/login-action@v1
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Tag image
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
tags: ${{ steps.meta.outputs.tags }}
push: true
run: yarn docker-build-prod --metadata ${{ steps.meta.outputs.json }}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
"scripts": {
"prepare": "husky install",
"docker-build-local": "node deploy/docker/create-docker-context.js --build --push --tag auto --local",
"docker-build-prod": "node deploy/docker/create-docker-context.js --build --push --tag auto --repository=ghcr.io/terriajs",
"docker-build-prod": "node deploy/docker/create-docker-context.js --build --push --platform=linux/amd64,linux/arm64",
"docker-build-ci": "node deploy/docker/create-docker-context.js --build",
"start": "terriajs-server --config-file devserverconfig.json",
"gulp": "gulp",
Expand Down

0 comments on commit 639ddf2

Please sign in to comment.