Skip to content

Merge pull request #5131 from mnaamani/luxor-qn-version #874

Merge pull request #5131 from mnaamani/luxor-qn-version

Merge pull request #5131 from mnaamani/luxor-qn-version #874

# Development builds of joystream-node (staging, testing, playground)
# Only built for amd64 on ubuntu
name: joystream-node-docker(dev)
on:
- push
- workflow_dispatch
env:
REPOSITORY: joystream/node
jobs:
ubuntu:
name: Build joystream/node Docker image for amd64
runs-on: ubuntu-latest
strategy:
matrix:
runtime_profile: ['FAST-PROD', 'PLAYGROUND', 'TESTING']
include:
- runtime_profile: 'FAST-PROD'
cargo_features: 'warp-time'
- runtime_profile: 'PLAYGROUND'
cargo_features: 'playground-runtime'
- runtime_profile: 'TESTING'
cargo_features: 'testing-runtime'
env:
RUNTIME_PROFILE: ${{ matrix.runtime_profile }}
steps:
- name: Make some space
shell: bash
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Checkout sources
uses: actions/checkout@v3
- id: compute_shasum
name: Compute runtime code shasum
run: |
export RUNTIME_CODE_SHASUM=`scripts/runtime-code-shasum.sh`
echo "::set-output name=shasum::${RUNTIME_CODE_SHASUM}"
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- name: Check if we have pre-built image on Dockerhub
id: compute_image_exists
# Will output 0 if image exists and 1 if does not exists
run: |
export IMAGE_EXISTS=$(docker manifest inspect ${{ env.REPOSITORY }}:${{ steps.compute_shasum.outputs.shasum }} > /dev/null ; echo $?)
echo "::set-output name=image_exists::${IMAGE_EXISTS}"
# Emulation only needed if cross compiling
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
# uses: docker/setup-buildx-action@dc7b9719a96d48369863986a06765841d7ea23f6 # v1.7
uses: docker/setup-buildx-action@v2
id: builder1
if: ${{ steps.compute_image_exists.outputs.image_exists == 1 }}
- name: Cache Docker layers
uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-dev
if: ${{ steps.compute_image_exists.outputs.image_exists == 1 }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
file: joystream-node.Dockerfile
# arm64 cross compiling takes longer than 6h, so we only build for amd64
# platforms: linux/amd64,linux/arm64
platforms: linux/amd64
build-args: |
CARGO_FEATURES=${{ matrix.cargo_features }}
CODE_SHASUM=${{ steps.compute_shasum.outputs.shasum }}
push: true
tags: ${{ env.REPOSITORY }}:${{ steps.compute_shasum.outputs.shasum }}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
builder: ${{ steps.builder1.outputs.name }}
if: ${{ steps.compute_image_exists.outputs.image_exists == 1 }}