Build neurodesktop-test #407
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build neurodesktop-test | |
# Scheduled production builds at 17:00 UTC every day. | |
# Build manually from here: https://github.com/NeuroDesk/neurodesktop/actions/workflows/build-neurodesktop.yml | |
# DockerHub: https://hub.docker.com/r/vnmd/neurodesktop | |
# Github Packages: https://github.com/NeuroDesk/neurodesktop/pkgs/container/neurodesktop%2Fneurodesktop | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 17 * * *' | |
env: | |
DOCKERHUB_ORG: ${{ vars.DOCKERHUB_ORG }} | |
jobs: | |
build-image: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Fetch github api rate limit | |
run: | | |
GITHUB_RATE_REMAINING=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/rate_limit | jq '.rate.remaining') | |
echo "GITHUB_RATE_REMAINING=${GITHUB_RATE_REMAINING}" | |
echo "GITHUB_RATE_REMAINING=$GITHUB_RATE_REMAINING" >> $GITHUB_ENV | |
# - name: Maximize build space | |
# uses: easimon/maximize-build-space@master | |
# with: | |
# root-reserve-mb: 40000 | |
# swap-size-mb: 1024 | |
# overprovision-lvm: 'true' | |
# remove-dotnet: 'true' | |
# remove-android: 'true' | |
# remove-haskell: 'true' | |
# remove-codeql: 'true' | |
# remove-docker-images: 'true' | |
- name: Checkout repository | |
if: ${{ env.GITHUB_RATE_REMAINING > 0 }} | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- name: Set environment variables | |
if: ${{ env.GITHUB_RATE_REMAINING > 0 }} | |
run: | | |
IMAGENAME="neurodesktop-test" | |
BUILDDATE=`date +%Y-%m-%d-%H%M` | |
IMAGEID=ghcr.io/$GITHUB_REPOSITORY/$IMAGENAME | |
IMAGEID=$(echo $IMAGEID | tr '[A-Z]' '[a-z]') | |
echo "BUILDDATE=$BUILDDATE" | |
echo "IMAGEID=$IMAGEID" | |
echo "IMAGENAME=$IMAGENAME" | |
echo "BUILDDATE=$BUILDDATE" >> $GITHUB_ENV | |
echo "IMAGEID=$IMAGEID" >> $GITHUB_ENV | |
echo "IMAGENAME=$IMAGENAME" >> $GITHUB_ENV | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build new image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
load: true | |
platforms: linux/amd64 | |
# platforms: linux/amd64,linux/arm64 | |
provenance: false # fixes unknown/unknown arch builds | |
no-cache: true | |
tags: ${{ env.IMAGEID }}:${{ env.BUILDDATE }} |