Elffuss BraidHub

kikocis/freqtrade public

develop · 1.1 KiB · executableRawPermalink
1#!/bin/sh
2
3# The below assumes a correctly setup docker buildx environment
4
5# Replace / with _ to create a valid tag
6TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
7PI_PLATFORM="linux/arm/v7"
8echo "Running for ${TAG}"
9CACHE_TAG=freqtradeorg/freqtrade_cache:${TAG}_cache
10
11# Add commit and commit_message to docker container
12echo "${GITHUB_SHA}" > freqtrade_commit
13
14if [ "${GITHUB_EVENT_NAME}" = "schedule" ]; then
15 echo "event ${GITHUB_EVENT_NAME}: full rebuild - skipping cache"
16 docker buildx build \
17 --cache-to=type=registry,ref=${CACHE_TAG} \
18 -f Dockerfile.armhf \
19 --platform ${PI_PLATFORM} \
20 -t ${IMAGE_NAME}:${TAG} --push .
21else
22 echo "event ${GITHUB_EVENT_NAME}: building with cache"
23 # Pull last build to avoid rebuilding the whole image
24 # docker pull --platform ${PI_PLATFORM} ${IMAGE_NAME}:${TAG}
25 docker buildx build \
26 --cache-from=type=registry,ref=${CACHE_TAG} \
27 --cache-to=type=registry,ref=${CACHE_TAG} \
28 -f Dockerfile.armhf \
29 --platform ${PI_PLATFORM} \
30 -t ${IMAGE_NAME}:${TAG} --push .
31fi
32
33if [ $? -ne 0 ]; then
34 echo "failed building image"
35 return 1
36fi