Skip to content

Commit

Permalink
ci (fix): add tari_network env support (#219)
Browse files Browse the repository at this point in the history
* Add integration_tests folder and bump rust docker base image to 1.67

* Bump monerod, rust image, tor and xmrig release

* Remove docker build caching, add TARI_NETWORK env support

* Add example env override for TARI_NETWORK and docker cache for build
  • Loading branch information
leet4tari committed Apr 5, 2023
1 parent 50f550d commit 48a5f58
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 21 deletions.
1 change: 1 addition & 0 deletions build_images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ build_tari_image() {
--build-arg VERSION=$2 \
--build-arg APP_NAME=$4 \
--build-arg APP_EXEC=$5 \
--build-arg TARI_NETWORK=${TARI_NETWORK} \
$6 $7 $8 $9 \
-t ${TL_TAG_URL}/$1:$2 $3 ${TL_TAG_BUILD_Extra} ${TL_TAG_CMD}
}
Expand Down
6 changes: 3 additions & 3 deletions docker_rig/monerod.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Binary build

# https://github.com/monero-project/monero/releases
ARG MONERO_VERSION=0.18.1.2
ARG MONERO_VERSION=0.18.2.0

# Declare stage using linux/amd64 base image
FROM --platform=linux/amd64 bitnami/minideb:bullseye AS build-stage-amd64
Expand All @@ -18,7 +18,7 @@ ARG MONERO_ARCH=x64
ARG MONERO_TAR=x86_64

# https://github.com/monero-project/monero/releases
ARG MONERO_AMD64_SHA256=7d51e7072351f65d0c7909e745827cfd3b00abe5e7c4cc4c104a3c9b526da07e
ARG MONERO_AMD64_SHA256=83e6517dc9e5198228ee5af50f4bbccdb226fe69ff8dd54404dddb90a70b7322
ARG MONERO_VERSION

# Declare stage using linux/arm64 base image
Expand All @@ -29,7 +29,7 @@ ARG MONERO_ARCH=armv8
ARG MONERO_TAR=aarch64

# https://github.com/monero-project/monero/releases
ARG MONERO_ARM64_SHA256=e1467fe289c98349be2b1c4c080e30a224eb3217c814fab0204241b2b19b9c6b
ARG MONERO_ARM64_SHA256=fb20eaf9b04020abdf883eb339258814742a1452653c1f5d8705d16e90413f35
ARG MONERO_VERSION

# Declare TARGETARCH to make it available
Expand Down
31 changes: 16 additions & 15 deletions docker_rig/tarilabs.Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# syntax = docker/dockerfile:1.3

# https://hub.docker.com/_/rust
ARG RUST_VERSION=1.68

# rust source compile with cross platform build support
FROM --platform=$BUILDPLATFORM rust:1.67-bullseye as builder
FROM --platform=$BUILDPLATFORM rust:$RUST_VERSION-bullseye as builder

# Declare to make available
ARG BUILDPLATFORM
Expand All @@ -12,13 +16,10 @@ ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG RUST_TOOLCHAIN
ARG RUST_TARGET
ARG RUST_VERSION

# Disable anti-cache
RUN rm -f /etc/apt/apt.conf.d/docker-clean; echo 'Binary::apt::APT::Keep-Downloaded-Packages "true";' > /etc/apt/apt.conf.d/keep-cache
# https://github.com/moby/buildkit/blob/master/frontend/dockerfile/docs/syntax.md#run---mounttypecache
RUN --mount=type=cache,id=build-apt-cache-${BUILDOS}-${BUILDARCH}${BUILDVARIANT},sharing=locked,target=/var/cache/apt \
--mount=type=cache,id=build-apt-lib-${BUILDOS}-${BUILDARCH}${BUILDVARIANT},sharing=locked,target=/var/lib/apt \
apt-get update && apt-get install -y \
RUN apt-get update && apt-get install -y \
apt-transport-https \
bash \
ca-certificates \
Expand Down Expand Up @@ -46,6 +47,7 @@ ENV CARGO_HTTP_MULTIPLEXING=false
ARG VERSION=1.0.1
ARG APP_NAME=wallet
ARG APP_EXEC=tari_console_wallet
ARG TARI_NETWORK

RUN if [ "${BUILDARCH}" != "${TARGETARCH}" ] && [ "${ARCH}" = "native" ] ; then \
echo "!! Cross-compile and native ARCH not a good idea !! " ; \
Expand All @@ -67,12 +69,7 @@ ADD meta meta
ADD buildtools/deps_only buildtools/deps_only
ADD integration_tests integration_tests

RUN --mount=type=cache,id=rust-git-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},sharing=locked,target=/home/rust/.cargo/git \
--mount=type=cache,id=rust-home-registry-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},sharing=locked,target=/home/rust/.cargo/registry \
--mount=type=cache,id=rust-local-registry-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},sharing=locked,target=/usr/local/cargo/registry \
--mount=type=cache,id=rust-src-target-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},sharing=locked,target=/home/rust/src/target \
--mount=type=cache,id=rust-target-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},sharing=locked,target=/tari/target \
if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "${TARGETARCH}" ] ; then \
RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "${TARGETARCH}" ] ; then \
# Hardcoded ARM64 envs for cross-compiling - FixMe soon
export BUILD_TARGET="aarch64-unknown-linux-gnu/" && \
export RUST_TARGET="--target=aarch64-unknown-linux-gnu" && \
Expand All @@ -85,12 +82,12 @@ RUN --mount=type=cache,id=rust-git-${TARGETOS}-${TARGETARCH}${TARGETVARIANT},sha
export RUSTFLAGS="-C target_cpu=$ARCH" && \
export ROARING_ARCH=$ARCH && \
rustup target add aarch64-unknown-linux-gnu && \
rustup toolchain install stable-aarch64-unknown-linux-gnu ; \
rustup toolchain install stable-aarch64-unknown-linux-gnu --force-non-host ; \
fi && \
if [ -n "${RUST_TOOLCHAIN}" ] ; then \
# Install a non-standard toolchain if it has been requested.
# By default we use the toolchain specified in rust-toolchain.toml
rustup toolchain install ${RUST_TOOLCHAIN} ; \
rustup toolchain install ${RUST_TOOLCHAIN} --force-non-host ; \
fi && \
rustup target list --installed && \
rustup toolchain list && \
Expand All @@ -106,11 +103,13 @@ ARG BUILDPLATFORM
ARG TARGETOS
ARG TARGETARCH
ARG TARGETVARIANT
ARG RUST_VERSION

ARG VERSION

ARG APP_NAME
ARG APP_EXEC
ARG TARI_NETWORK

# Disable Prompt During Packages Installation
ARG DEBIAN_FRONTEND=noninteractive
Expand All @@ -136,8 +135,10 @@ RUN groupadd --gid 1000 tari && \

ENV dockerfile_version=$VERSION
ENV dockerfile_build_arch=$BUILDPLATFORM
ENV rust_version=$RUST_VERSION
ENV APP_NAME=${APP_NAME:-wallet}
ENV APP_EXEC=${APP_EXEC:-tari_console_wallet}
ENV TARI_NETWORK=$TARI_NETWORK

RUN mkdir -p "/var/tari/${APP_NAME}" && \
chown -R tari:tari "/var/tari/${APP_NAME}"
Expand Down
2 changes: 1 addition & 1 deletion docker_rig/tor.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ARG BUILDPLATFORM
ARG VERSION=1.0.1

# https://pkgs.alpinelinux.org/packages?name=tor&branch=v3.17&repo=community&arch=&maintainer=
ARG TOR_VERSION=0.4.7.12-r0
ARG TOR_VERSION=0.4.7.13-r0

# Install tor with a minimum version
RUN apk update \
Expand Down
2 changes: 1 addition & 1 deletion docker_rig/xmrig.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ ARG ALPINE_VERSION
ARG BUILDPLATFORM

# https://github.com/xmrig/xmrig/releases
ARG XMRIG_VERSION="v6.18.1"
ARG XMRIG_VERSION="v6.19.1"

RUN apk add \
git \
Expand Down
13 changes: 12 additions & 1 deletion hosted-dual.env
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,15 @@ export TL_TAG_URL=quay.io/tarilabs
export TL_TAG_ALIAS=latest

#export TL_TAG_BUILD_OPTS="buildx build -o type=docker --progress=plain --platform linux/amd64 --no-cache"
export TL_TAG_BUILD_OPTS="buildx build --platform linux/amd64,linux/arm64 --push"
#export TL_TAG_BUILD_OPTS="buildx build --platform linux/amd64,linux/arm64 --push"
export TL_TAG_BUILD_OPTS="\
buildx build \
--progress=plain \
--platform linux/amd64,linux/arm64 \
--push \
--cache-from type=local,src=/tmp/docker-cache \
--cache-to type=local,dest=/tmp/docker-cache,mode=max \
"

# Pull App version from file
VAPP=$(awk -F ' = ' \
Expand All @@ -32,3 +40,6 @@ export SUBTAG_EXTRA="_v${VAPP}_${VBRANCH}_$(date -u '+%Y%m%d')_${VSHA_SHORT}"

# Docker Build extra commands
#export TL_TAG_BUILD_Extra=" --build-arg RUST_TOOLCHAIN=nightly-2022-05-01 "

# Override Network
#export TARI_NETWORK=esme

0 comments on commit 48a5f58

Please sign in to comment.