Skip to content

Merge pull request #465 from kreneskyp/hash_list_customization #249

Merge pull request #465 from kreneskyp/hash_list_customization

Merge pull request #465 from kreneskyp/hash_list_customization #249

Workflow file for this run

name: Publish Dev
# run on merge
# Testing note: if testing this against PRs note that this will always fail in a PR
# the first time because the image doesn't exist yet. Re-running the
# workflow after `build` job has run will succeed.
on:
push:
branches: [master]
jobs:
docker:
runs-on: ubuntu-latest
steps:
# setup
- name: Checkout
uses: actions/checkout@v4
- name: Load image urls
id: load_image_url
run: |
IMAGE_URL=`make image-url`
IMAGE_URL_NODEJS=`make image-url-nodejs`
echo "image-url=$IMAGE_URL" >> "$GITHUB_OUTPUT"
echo "image-url-nodejs=$IMAGE_URL_NODEJS" >> "$GITHUB_OUTPUT"
# attempt to load both images from cache
- name: Restore Sandbox Image Cache
uses: actions/cache@v3
id: restore_cache
with:
path: image.tar
key: ${{ steps.load_image_url.outputs.image-url }}
- name: load image
if: steps.restore_cache.outputs.cache-hit == 'true'
shell: bash
run: |
docker load --input image.tar
docker tag ${{ steps.load_image_url.outputs.image-url }} ghcr.io/kreneskyp/ix/sandbox:latest
- name: Restore NodeJS Image Cache
uses: actions/cache@v3
id: restore_cache_nodejs
with:
path: image-nodejs.tar
key: ${{ steps.load_image_url.outputs.image-url-nodejs }}
- name: load nodejs image
if: steps.restore_cache_nodejs.outputs.cache-hit == 'true'
shell: bash
run: |
docker load --input image-nodejs.tar
docker tag ${{ steps.load_image_url.outputs.image-url-nodejs }} ghcr.io/kreneskyp/ix/nodejs:latest
# build images - Both images must be built locally a because it's needed to build the frontend.
# The cache wasn't working reliably across workflows, so it must be built here. This
# build is not multi-platform since it is needed locally.
- name: Build Sandbox image
id: build
if: steps.restore_cache.outputs.cache-hit != 'true'
run: |
mkdir -p .sentinel
IMAGE_URL=`make image-url`
echo "Building Sandbox Docker image: $IMAGE_URL"
make image
- name: Build NodeJS image
id: build-nodejs
if: steps.restore_cache_nodejs.outputs.cache-hit != 'true'
run: |
mkdir -p .sentinel
IMAGE_URL_NODEJS=`make image-url-nodejs`
echo "Building NodeJS Docker image: $IMAGE_URL_NODEJS"
make nodejs
# build javascript frontend - output will be added to image
- name: run
shell: bash
env:
NO_IMAGE_BUILD: 1
run: |
touch .env
make frontend
# docker multi-platform build + publish
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: true
tags: ghcr.io/kreneskyp/ix/sandbox:dev