Skip to content

Commit

Permalink
Add workflow to create the build layer images
Browse files Browse the repository at this point in the history
  • Loading branch information
muzuke committed Oct 19, 2024
1 parent d794bef commit e7cd864
Show file tree
Hide file tree
Showing 3 changed files with 119 additions and 11 deletions.
108 changes: 108 additions & 0 deletions .github/workflows/docker-layers.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
name: Docker layers

#
# The workflow is meant to be triggered manually when there is a need to update the build layers.
#

on:
# TODO: To be removed after PR is merged.
pull_request:

workflow_dispatch:
inputs:
version:
description: "The version tag to use"
required: true
default: latest

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

env:
TMP_LOCAL_IMAGE: localhost:5000/radixdlt/babylon-node-build-layers
REGISTRY_IMAGE: docker.io/radixdlt/babylon-node-build-layers
REGISTRY_TAG: latest

jobs:
build_java_layer:
strategy:
matrix:
os: ["ubuntu-latest-8-cores", "ubuntu-latest-arm-8-cores"]
arch: ["amd64", "arm64"]
exclude:
- os: ubuntu-latest-8-cores
arch: arm64
- os: ubuntu-latest-arm-8-cores
arch: amd64
name: Build Java docker layer
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: RDXWorks-actions/checkout@main
- name: Set up Docker Buildx
uses: RDXWorks-actions/setup-buildx-action@master
- name: Prepare docker build
run: |
mkdir -p /tmp/images
platform=${{ matrix.arch }}
echo "TARFILE=${platform}-java.tar" >> $GITHUB_ENV
echo "TAG=${{ env.TMP_LOCAL_IMAGE }}:${platform}-java" >> $GITHUB_ENV
- name: Build image
uses: RDXWorks-actions/build-push-action@v6
with:
file: ./docker/dockerfiles/java.dockerfile
context: .
platforms: linux/${{ matrix.arch }}
tags: ${{ env.TAG }}-java
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/images/${{ env.TARFILE }}
push: false
- name: Upload images
uses: RDXWorks-actions/upload-artifact-v4@main
with:
name: images-${{ matrix.arch }}-java
path: /tmp/images/${{ env.TARFILE }}
if-no-files-found: error
retention-days: 1

build_rust_layer:
strategy:
matrix:
os: ["ubuntu-latest-8-cores", "ubuntu-latest-arm-8-cores"]
arch: ["amd64", "arm64"]
exclude:
- os: ubuntu-latest-8-cores
arch: arm64
- os: ubuntu-latest-arm-8-cores
arch: amd64
name: Build Rust docker layer
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: RDXWorks-actions/checkout@main
- name: Set up Docker Buildx
uses: RDXWorks-actions/setup-buildx-action@master
- name: Prepare docker build
run: |
mkdir -p /tmp/images
platform=${{ matrix.arch }}
echo "TARFILE=${platform}-rust.tar" >> $GITHUB_ENV
echo "TAG=${{ env.TMP_LOCAL_IMAGE }}:${platform}-rust" >> $GITHUB_ENV
- name: Build image
uses: RDXWorks-actions/build-push-action@v6
with:
file: ./docker/dockerfiles/rust.dockerfile
context: .
platforms: linux/${{ matrix.arch }}
tags: ${{ env.TAG }}-rust
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/images/${{ env.TARFILE }}
push: false
- name: Upload images
uses: RDXWorks-actions/upload-artifact-v4@main
with:
name: images-${{ matrix.arch }}-rust
path: /tmp/images/${{ env.TARFILE }}
if-no-files-found: error
retention-days: 1
16 changes: 8 additions & 8 deletions .github/workflows/docker-v2.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
name: Docker v2

on:
pull_request:
# release:
# types: [published]
# push:
# branches:
# - develop
# - main
# - release\/*
# pull_request:
release:
types: [published]
push:
branches:
- develop
- main
- release\/*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand Down
6 changes: 3 additions & 3 deletions Dockerfile.v2
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM radixdlt/build-layers:java AS java-container
FROM radixdlt/babylon-node-build-layers:v1.2.3-java AS java-container

WORKDIR /radixdlt

Expand Down Expand Up @@ -30,7 +30,7 @@ RUN cd core/build/distributions && \
cp *.jar /artifacts && \
cp core /artifacts

FROM radixdlt/build-layers:rust AS rust-container
FROM radixdlt/babylon-node-build-layers:v1.2.3-rust AS rust-container

WORKDIR /app

Expand All @@ -40,7 +40,7 @@ RUN mkdir -p /artifacts && \
/root/.cargo/bin/cargo build --profile=release && \
cp target/release/libcorerust.so /artifacts/libcorerust.so

FROM radixdlt/build-layers:app AS main
FROM radixdlt/babylon-node-build-layers:v1.2.3-app AS main

# Copy in the application artifacts
COPY --from=java-container /artifacts/*.jar /opt/radixdlt/lib/
Expand Down

0 comments on commit e7cd864

Please sign in to comment.