Merge pull request #3380 from freqtrade/rpi_crosscompile
Raspberry Docker image - fix and correctly crosscompile
This commit is contained in:
commit
e0dc7fedf5
69
.github/workflows/ci.yml
vendored
69
.github/workflows/ci.yml
vendored
@ -100,7 +100,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Slack Notification
|
- name: Slack Notification
|
||||||
uses: homoluctus/slatify@v1.8.0
|
uses: homoluctus/slatify@v1.8.0
|
||||||
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||||
with:
|
with:
|
||||||
type: ${{ job.status }}
|
type: ${{ job.status }}
|
||||||
job_name: '*Freqtrade CI ${{ matrix.os }}*'
|
job_name: '*Freqtrade CI ${{ matrix.os }}*'
|
||||||
@ -162,7 +162,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Slack Notification
|
- name: Slack Notification
|
||||||
uses: homoluctus/slatify@v1.8.0
|
uses: homoluctus/slatify@v1.8.0
|
||||||
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
if: failure() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||||
with:
|
with:
|
||||||
type: ${{ job.status }}
|
type: ${{ job.status }}
|
||||||
job_name: '*Freqtrade CI windows*'
|
job_name: '*Freqtrade CI windows*'
|
||||||
@ -189,6 +189,29 @@ jobs:
|
|||||||
channel: '#notifications'
|
channel: '#notifications'
|
||||||
url: ${{ secrets.SLACK_WEBHOOK }}
|
url: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
|
||||||
|
cleanup-prior-runs:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Cleanup previous runs on this branch
|
||||||
|
uses: rokroskar/workflow-run-cleanup-action@v0.2.2
|
||||||
|
if: "!startsWith(github.ref, 'refs/tags/') && github.ref != 'refs/heads/master' && github.repository == 'freqtrade/freqtrade'"
|
||||||
|
env:
|
||||||
|
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
|
||||||
|
|
||||||
|
# Notify on slack only once - when CI completes (and after deploy) in case it's successfull
|
||||||
|
notify-complete:
|
||||||
|
needs: [ build, build_windows, docs_check ]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- name: Slack Notification
|
||||||
|
uses: homoluctus/slatify@v1.8.0
|
||||||
|
if: always() && ( github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork == false)
|
||||||
|
with:
|
||||||
|
type: ${{ job.status }}
|
||||||
|
job_name: '*Freqtrade CI*'
|
||||||
|
channel: '#notifications'
|
||||||
|
url: ${{ secrets.SLACK_WEBHOOK }}
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: [ build, build_windows, docs_check ]
|
needs: [ build, build_windows, docs_check ]
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
@ -226,25 +249,45 @@ 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
|
# We need docker experimental to pull the ARM image.
|
||||||
uses: elgohr/Publish-Docker-Github-Action@2.7
|
- name: Switch docker to experimental
|
||||||
|
run: |
|
||||||
|
docker version -f '{{.Server.Experimental}}'
|
||||||
|
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
|
||||||
|
sudo systemctl restart docker
|
||||||
|
docker version -f '{{.Server.Experimental}}'
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
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 }}_pi
|
||||||
|
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" ]
|
@ -1,41 +0,0 @@
|
|||||||
FROM balenalib/raspberrypi3-debian:stretch
|
|
||||||
|
|
||||||
RUN [ "cross-build-start" ]
|
|
||||||
|
|
||||||
RUN apt-get update \
|
|
||||||
&& apt-get -y install wget curl build-essential libssl-dev libffi-dev \
|
|
||||||
&& apt-get clean
|
|
||||||
|
|
||||||
# Prepare environment
|
|
||||||
RUN mkdir /freqtrade
|
|
||||||
WORKDIR /freqtrade
|
|
||||||
|
|
||||||
# Install TA-lib
|
|
||||||
COPY build_helpers/ta-lib-0.4.0-src.tar.gz /freqtrade/
|
|
||||||
RUN tar -xzf /freqtrade/ta-lib-0.4.0-src.tar.gz \
|
|
||||||
&& cd /freqtrade/ta-lib/ \
|
|
||||||
&& ./configure \
|
|
||||||
&& make \
|
|
||||||
&& make install \
|
|
||||||
&& rm /freqtrade/ta-lib-0.4.0-src.tar.gz
|
|
||||||
|
|
||||||
ENV LD_LIBRARY_PATH /usr/local/lib
|
|
||||||
|
|
||||||
# Install berryconda
|
|
||||||
RUN wget -q https://github.com/jjhelmus/berryconda/releases/download/v2.0.0/Berryconda3-2.0.0-Linux-armv7l.sh \
|
|
||||||
&& bash ./Berryconda3-2.0.0-Linux-armv7l.sh -b \
|
|
||||||
&& rm Berryconda3-2.0.0-Linux-armv7l.sh
|
|
||||||
|
|
||||||
# Install dependencies
|
|
||||||
COPY requirements-common.txt /freqtrade/
|
|
||||||
RUN ~/berryconda3/bin/conda install -y numpy pandas \
|
|
||||||
&& ~/berryconda3/bin/pip install -r requirements-common.txt --no-cache-dir
|
|
||||||
|
|
||||||
# Install and execute
|
|
||||||
COPY . /freqtrade/
|
|
||||||
RUN ~/berryconda3/bin/pip install -e . --no-cache-dir
|
|
||||||
|
|
||||||
RUN [ "cross-build-end" ]
|
|
||||||
|
|
||||||
ENTRYPOINT ["/root/berryconda3/bin/python","./freqtrade/main.py"]
|
|
||||||
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
|
||||||
|
|
||||||
|
36
build_helpers/publish_docker_pi.sh
Executable file
36
build_helpers/publish_docker_pi.sh
Executable file
@ -0,0 +1,36 @@
|
|||||||
|
#!/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}"
|
||||||
|
CACHE_TAG=freqtradeorg/freqtrade_cache:${TAG}_cache
|
||||||
|
|
||||||
|
# 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 \
|
||||||
|
--cache-to=type=registry,ref=${CACHE_TAG} \
|
||||||
|
-f Dockerfile.armhf \
|
||||||
|
--platform ${PI_PLATFORM} \
|
||||||
|
-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=type=registry,ref=${CACHE_TAG} \
|
||||||
|
--cache-to=type=registry,ref=${CACHE_TAG} \
|
||||||
|
-f Dockerfile.armhf \
|
||||||
|
--platform ${PI_PLATFORM} \
|
||||||
|
-t ${IMAGE_NAME}:${TAG} --push .
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo "failed building image"
|
||||||
|
return 1
|
||||||
|
fi
|
Loading…
Reference in New Issue
Block a user