Test rpi using buildx and dockerfile.armhf
Uses piwheels for pi image
This commit is contained in:
parent
b50d072d82
commit
a7c0e86bfd
35
.github/workflows/ci.yml
vendored
35
.github/workflows/ci.yml
vendored
@ -6,6 +6,7 @@ on:
|
|||||||
- master
|
- master
|
||||||
- develop
|
- develop
|
||||||
- github_actions_tests
|
- github_actions_tests
|
||||||
|
- rpi_crosscompile
|
||||||
tags:
|
tags:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published]
|
||||||
@ -226,25 +227,37 @@ jobs:
|
|||||||
user: __token__
|
user: __token__
|
||||||
password: ${{ secrets.pypi_password }}
|
password: ${{ secrets.pypi_password }}
|
||||||
|
|
||||||
|
- name: Dockerhub login
|
||||||
|
env:
|
||||||
|
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
run: |
|
||||||
|
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin
|
||||||
|
|
||||||
- name: Build and test and push docker image
|
- name: Build and test and push docker image
|
||||||
env:
|
env:
|
||||||
IMAGE_NAME: freqtradeorg/freqtrade
|
IMAGE_NAME: freqtradeorg/freqtrade
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
|
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
|
||||||
run: |
|
run: |
|
||||||
build_helpers/publish_docker.sh
|
build_helpers/publish_docker.sh
|
||||||
|
|
||||||
- name: Build raspberry image for ${{ steps.extract_branch.outputs.branch }}_pi
|
- name: Set up Docker Buildx
|
||||||
uses: elgohr/Publish-Docker-Github-Action@2.7
|
id: buildx
|
||||||
|
uses: crazy-max/ghaction-docker-buildx@v1
|
||||||
with:
|
with:
|
||||||
name: freqtradeorg/freqtrade:${{ steps.extract_branch.outputs.branch }}_pi
|
buildx-version: latest
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
qemu-version: latest
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
dockerfile: Dockerfile.pi
|
- name: Available platforms
|
||||||
# cache: true
|
run: echo ${{ steps.buildx.outputs.platforms }}
|
||||||
cache: ${{ github.event_name != 'schedule' }}
|
|
||||||
tag_names: true
|
- name: Build Raspberry docker image
|
||||||
|
env:
|
||||||
|
IMAGE_NAME: freqtradeorg/freqtrade
|
||||||
|
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
|
||||||
|
run: |
|
||||||
|
build_helpers/publish_docker_pi.sh
|
||||||
|
|
||||||
|
|
||||||
- name: Slack Notification
|
- name: Slack Notification
|
||||||
uses: homoluctus/slatify@v1.8.0
|
uses: homoluctus/slatify@v1.8.0
|
||||||
|
29
Dockerfile.armhf
Normal file
29
Dockerfile.armhf
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
FROM --platform=linux/arm/v7 python:3.7.7-slim-buster
|
||||||
|
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get -y install curl build-essential libssl-dev libatlas3-base libgfortran5 \
|
||||||
|
&& apt-get clean \
|
||||||
|
&& pip install --upgrade pip \
|
||||||
|
&& echo "[global]\nextra-index-url=https://www.piwheels.org/simple" > /etc/pip.conf
|
||||||
|
|
||||||
|
# Prepare environment
|
||||||
|
RUN mkdir /freqtrade
|
||||||
|
WORKDIR /freqtrade
|
||||||
|
|
||||||
|
# Install TA-lib
|
||||||
|
COPY build_helpers/* /tmp/
|
||||||
|
RUN cd /tmp && /tmp/install_ta-lib.sh && rm -r /tmp/*ta-lib*
|
||||||
|
|
||||||
|
ENV LD_LIBRARY_PATH /usr/local/lib
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
COPY requirements.txt requirements-common.txt /freqtrade/
|
||||||
|
RUN pip install numpy --no-cache-dir \
|
||||||
|
&& pip install -r requirements.txt --no-cache-dir
|
||||||
|
|
||||||
|
# Install and execute
|
||||||
|
COPY . /freqtrade/
|
||||||
|
RUN pip install -e . --no-cache-dir
|
||||||
|
ENTRYPOINT ["freqtrade"]
|
||||||
|
# Default to trade mode
|
||||||
|
CMD [ "trade" ]
|
@ -42,14 +42,6 @@ if [ "${TAG}" = "develop" ]; then
|
|||||||
docker tag freqtrade:$TAG ${IMAGE_NAME}:latest
|
docker tag freqtrade:$TAG ${IMAGE_NAME}:latest
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Login
|
|
||||||
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
|
|
||||||
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo "failed login"
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Show all available images
|
# Show all available images
|
||||||
docker images
|
docker images
|
||||||
|
|
||||||
|
45
build_helpers/publish_docker_pi.sh
Executable file
45
build_helpers/publish_docker_pi.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# The below assumes a correctly setup docker buildx environment
|
||||||
|
|
||||||
|
# Replace / with _ to create a valid tag
|
||||||
|
TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g")
|
||||||
|
PI_PLATFORM="linux/arm/v7"
|
||||||
|
echo "Running for ${TAG}"
|
||||||
|
|
||||||
|
# Add commit and commit_message to docker container
|
||||||
|
echo "${GITHUB_SHA}" > freqtrade_commit
|
||||||
|
|
||||||
|
if [ "${GITHUB_EVENT_NAME}" = "schedule" ]; then
|
||||||
|
echo "event ${GITHUB_EVENT_NAME}: full rebuild - skipping cache"
|
||||||
|
docker buildx build --platform linux/arm/v7 -t ${IMAGE_NAME}:${TAG} --push .
|
||||||
|
else
|
||||||
|
echo "event ${GITHUB_EVENT_NAME}: building with cache"
|
||||||
|
# Pull last build to avoid rebuilding the whole image
|
||||||
|
docker pull --platform ${PI_PLATFORM} ${IMAGE_NAME}:${TAG}
|
||||||
|
docker buildx build --cache-from ${IMAGE_NAME}:${TAG} --platform ${PI_PLATFORM} -t ${IMAGE_NAME}:${TAG} --push .
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "failed building image"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Tag as latest for develop builds
|
||||||
|
if [ "${TAG}" = "develop" ]; then
|
||||||
|
docker tag ${IMAGE_NAME}:$TAG ${IMAGE_NAME}:latest
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "failed login"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Show all available images
|
||||||
|
docker images
|
||||||
|
|
||||||
|
docker push ${IMAGE_NAME}
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "failed pushing to repo"
|
||||||
|
return 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user