Skip to content

Commit

Permalink
chore(ci): migrate docker build back into repo and remove docker buil…
Browse files Browse the repository at this point in the history
…d section from ReadMe
  • Loading branch information
leet4tari committed Feb 12, 2025
1 parent 9e3ef5b commit eb9b250
Show file tree
Hide file tree
Showing 13 changed files with 486 additions and 165 deletions.
11 changes: 7 additions & 4 deletions .github/workflows/build_dockers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ name: Build docker images
- minotari_sha3_miner
- 3rdparty_all
- tor
- monerod
- xmrig
#- monerod
#- xmrig

env:
toolchain_default: nightly-2024-07-07
Expand Down Expand Up @@ -91,8 +91,11 @@ jobs:
if [[ "${{ github.ref }}" =~ ^refs/heads/build-dockers-* ]] || [[ "${{ github.ref }}" =~ ^refs/heads/build-all-* ]] ; then
echo "Branch Build - limited dual arch"
echo "platforms=linux/arm64, linux/amd64" >> $GITHUB_OUTPUT
echo "tag_alias=latest-weekly" >> $GITHUB_OUTPUT
echo "build_items=minotari_all" >> $GITHUB_OUTPUT
echo "tag_alias=latest-testing" >> $GITHUB_OUTPUT
#echo "build_items=xmrig" >> $GITHUB_OUTPUT
#echo "build_items=3rdparty" >> $GITHUB_OUTPUT
#echo "build_items=minotari_all" >> $GITHUB_OUTPUT
echo "build_items=all" >> $GITHUB_OUTPUT
fi
if [ "${{ github.event_name }}" == "workflow_dispatch" ] ; then
echo "Manual Build - selective"
Expand Down
41 changes: 12 additions & 29 deletions .github/workflows/build_dockers_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@ name: Build docker images - workflow_call/on-demand
default: linux/amd64

env:
LAUNCHPAD_REPO: tari-project/tari-launchpad
LAUNCHPAD_BRANCH: main
DAYS_to_EXPIRE: 30

permissions: {}
Expand All @@ -50,12 +48,8 @@ jobs:
matrix: ${{ steps.set_matrix.outputs.matrix }}

steps:
- name: checkout tari-launchpad
- name: checkout tari
uses: actions/checkout@v4
with:
repository: ${{ env.LAUNCHPAD_REPO }}
ref: ${{ env.LAUNCHPAD_BRANCH }}
path: tari-launchpad

- name: Set Matrix
id: set_matrix
Expand All @@ -65,21 +59,21 @@ jobs:
echo "Building with ${build_items}."
if [ -z "${build_items}" ] || [ "${build_items}" = "minotari_all" ] ; then
echo "Build all Minotari images"
matrix_selection=$( jq -s -c '.[]' tari-launchpad/tarisuite.json )
matrix_selection=$( jq -s -c '.[]' ./buildtools/docker_rig/tarisuite.json )
elif [ "${build_items:0:9}" = "minotari_" ] ; then
echo "Build only selected minotari images - ${build_items}"
matrix_selection=$( jq --arg jsonVar "${build_items}" -r '[. []
| select(."image_name"==$jsonVar)]' tari-launchpad/tarisuite.json )
| select(."image_name"==$jsonVar)]' ./buildtools/docker_rig/tarisuite.json )
elif [ "${build_items}" = "all" ] ; then
echo "Build all images"
matrix_selection=$( jq -c '. += input' tari-launchpad/tarisuite.json tari-launchpad/3rdparty.json )
matrix_selection=$( jq -c '. += input' ./buildtools/docker_rig/tarisuite.json ./buildtools/docker_rig/3rdparty.json )
elif [ "${build_items:0:8}" = "3rdparty" ] ; then
echo "Build only 3rdparty images - ${build_items}"
matrix_selection=$( jq -s -c '.[]' tari-launchpad/3rdparty.json )
matrix_selection=$( jq -s -c '.[]' ./buildtools/docker_rig/3rdparty.json )
else
echo "Build only selected 3rdparty images - ${build_items}"
matrix_selection=$( jq --arg jsonVar "${build_items}" -r '[. []
| select(."image_name"==$jsonVar)]' tari-launchpad/3rdparty.json )
| select(."image_name"==$jsonVar)]' ./buildtools/docker_rig/3rdparty.json )
# "!! Broken selection? !!"
# exit 1
fi
Expand Down Expand Up @@ -108,21 +102,12 @@ jobs:
steps:
- name: checkout tari
uses: actions/checkout@v4
with:
path: tari

- name: checkout tari-launchpad
uses: actions/checkout@v4
with:
repository: ${{ env.LAUNCHPAD_REPO }}
ref: ${{ env.LAUNCHPAD_BRANCH }}
path: tari-launchpad

- name: Declare TestNet for tags
if: ${{ startsWith(github.ref, 'refs/tags/v') }}
shell: bash
run: |
source tari/buildtools/multinet_envs.sh ${{github.ref_name}}
source ./buildtools/multinet_envs.sh ${{github.ref_name}}
echo ${TARI_NETWORK}
echo "TARI_NETWORK=${TARI_NETWORK}" >> $GITHUB_ENV
echo ${TARI_TARGET_NETWORK}
Expand All @@ -140,7 +125,7 @@ jobs:
IMAGE_NAME=${{ matrix.builds.image_name }}
if [ -z "${{ inputs.version }}" ] ; then
echo "Get tari version"
TARI_SOURCE_ROOT="tari/"
TARI_SOURCE_ROOT="./"
VAPP=$(awk -F ' = ' '$1 ~ /^version/ \
{ gsub(/["]/, "", $2); printf("%s",$2) }' \
"${TARI_SOURCE_ROOT}/applications/minotari_node/Cargo.toml")
Expand All @@ -163,18 +148,16 @@ jobs:
fi
if [ "${IMAGE_NAME:0:9}" = "minotari_" ] ; then
echo "Minotari builds"
mkdir -p tari/buildtools/docker_rig
cp -v tari-launchpad/docker_rig/start_tari_app.sh tari/buildtools/docker_rig/start_tari_app.sh
echo "DOCKERFILE=tarilabs" >> $GITHUB_ENV
echo "APP_NAME=${{ matrix.builds.app_name }}" >> $GITHUB_ENV
echo "APP_EXEC=${{ matrix.builds.app_exec }}" >> $GITHUB_ENV
else
echo "3rd Party builds - ${IMAGE_NAME}"
if [ -f "./tari-launchpad/docker_rig/${IMAGE_NAME}.Dockerfile" ] ; then
if [ -f "./buildtools/docker_rig/${IMAGE_NAME}.Dockerfile" ] ; then
echo "DOCKERFILE=${IMAGE_NAME}" >> $GITHUB_ENV
SUBTAG=$(awk -v search="^ARG ${IMAGE_NAME^^}?_VERSION=" -F '=' '$0 ~ search \
{ gsub(/["]/, "", $2); printf("%s",$2) }' \
"./tari-launchpad/docker_rig/${IMAGE_NAME}.Dockerfile")
"./buildtools/docker_rig/${IMAGE_NAME}.Dockerfile")
echo "Docker subtag - ${SUBTAG}"
echo "VERSION=${SUBTAG}_${VERSION}" >> $GITHUB_ENV
echo "DOCKER_SUBTAG=--build-arg ${IMAGE_NAME^^}_VERSION=${SUBTAG}" >> $GITHUB_ENV
Expand Down Expand Up @@ -226,8 +209,8 @@ jobs:
id: docker_build
uses: docker/build-push-action@v6
with:
context: ./tari/
file: ./tari-launchpad/docker_rig/${{ env.DOCKERFILE }}.Dockerfile
context: .
file: ./buildtools/docker_rig/${{ env.DOCKERFILE }}.Dockerfile
platforms: ${{ inputs.platforms }}
push: true
provenance: false
Expand Down
31 changes: 1 addition & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ version: "3"

services:
minotari_node:
image: quay.io/tarilabs/minotari_node:v0.5.4
image: quay.io/tarilabs/minotari_node:latest-nextnet
restart: unless-stopped
volumes:
- ./data:/root/.tari
Expand Down Expand Up @@ -397,35 +397,6 @@ Syncing 5229/5233
---
### Building a Docker image
If you don't want to use the Docker images provided by the community, you can roll your own!
First, clone the Tari repo:
```bash
git clone git@github.com:tari-project/tari.git
```

Then build the image using the dockerfile in `buildtools`. The base node dockerfile builds the application and then
places the binary inside a small container, keeping the executable binary to a minimum:

docker build -t minotari_node:latest -f ./buildtools/base_node.Dockerfile .

Test your image:

docker run --rm -ti minotari_node minotari_node --help

Run the base node:

docker run -ti -v /path/to/config/dir:/root/.tari minotari_node

Default Docker builds for base x86-64 CPU. Better performing builds can be created by passing build options:

docker build -t minotari_node:performance --build-arg TBN_ARCH=skylake --build-arg TBN_FEATURES=avx2 -f ./buildtools/base_node.Dockerfile .

---

## Mining
The Tari protocol supports hybrid mining; stand-alone or pooled SHA3 mining using the Minotari Miner or merged mining with
Expand Down
76 changes: 0 additions & 76 deletions buildtools/docker/base_node.Dockerfile

This file was deleted.

20 changes: 0 additions & 20 deletions buildtools/docker/start.sh

This file was deleted.

6 changes: 0 additions & 6 deletions buildtools/docker/torrc

This file was deleted.

5 changes: 5 additions & 0 deletions buildtools/docker_rig/3rdparty.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{
"image_name": "tor"
}
]
Loading

0 comments on commit eb9b250

Please sign in to comment.