diff --git a/.dockerignore b/.dockerignore index 889a4dfc7..abc5b82f0 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,6 +3,7 @@ Dockerfile Dockerfile.armhf .dockerignore +docker/ .coveragerc .eggs .github diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5a0837eb2..ea766d77d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -374,13 +374,6 @@ jobs: run: | echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin - - name: Build and test and push docker image - env: - IMAGE_NAME: freqtradeorg/freqtrade - BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} - run: | - build_helpers/publish_docker.sh - # We need docker experimental to pull the ARM image. - name: Switch docker to experimental run: | @@ -399,10 +392,17 @@ jobs: - name: Available platforms run: echo ${{ steps.buildx.outputs.platforms }} + - name: Build and test and push docker image + env: + IMAGE_NAME: freqtradeorg/freqtrade + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} + run: | + build_helpers/publish_docker.sh + - name: Build Raspberry docker image env: IMAGE_NAME: freqtradeorg/freqtrade - BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}_pi + BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }} run: | build_helpers/publish_docker_pi.sh diff --git a/Dockerfile b/Dockerfile index b12cde6bb..f2d7c8a40 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,8 +10,8 @@ ENV FT_APP_ENV="docker" # Prepare environment RUN mkdir /freqtrade \ - && apt update \ - && apt install -y sudo \ + && apt-get update \ + && apt-get -y install sudo libatlas3-base curl sqlite3 libhdf5-serial-dev \ && apt-get clean \ && useradd -u 1000 -G sudo -U -m ftuser \ && chown ftuser:ftuser /freqtrade \ @@ -22,10 +22,10 @@ WORKDIR /freqtrade # Install dependencies FROM base as python-deps -RUN apt-get update \ - && apt-get -y install curl build-essential libssl-dev git \ - && apt-get clean \ - && pip install --upgrade pip +RUN apt-get update \ + && apt-get -y install build-essential libssl-dev git libffi-dev libgfortran5 pkg-config cmake gcc \ + && apt-get clean \ + && pip install --upgrade pip # Install TA-lib COPY build_helpers/* /tmp/ diff --git a/build_helpers/publish_docker.sh b/build_helpers/publish_docker.sh index d987bcc69..da9fc4e34 100755 --- a/build_helpers/publish_docker.sh +++ b/build_helpers/publish_docker.sh @@ -53,6 +53,7 @@ docker images docker push ${IMAGE_NAME} docker push ${IMAGE_NAME}:$TAG_PLOT docker push ${IMAGE_NAME}:$TAG + if [ $? -ne 0 ]; then echo "failed pushing repo" return 1 diff --git a/build_helpers/publish_docker_pi.sh b/build_helpers/publish_docker_pi.sh index 060b1deaf..c7024828b 100755 --- a/build_helpers/publish_docker_pi.sh +++ b/build_helpers/publish_docker_pi.sh @@ -3,7 +3,9 @@ # The below assumes a correctly setup docker buildx environment # Replace / with _ to create a valid tag -TAG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g") +TAG_ORIG=$(echo "${BRANCH_NAME}" | sed -e "s/\//_/g") +TAG="${TAG_ORIG}_pi" + PI_PLATFORM="linux/arm/v7" echo "Running for ${TAG}" CACHE_TAG=freqtradeorg/freqtrade_cache:${TAG}_cache @@ -15,7 +17,7 @@ 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 \ + -f docker/Dockerfile.armhf \ --platform ${PI_PLATFORM} \ -t ${IMAGE_NAME}:${TAG} --push . else @@ -25,11 +27,22 @@ else docker buildx build \ --cache-from=type=registry,ref=${CACHE_TAG} \ --cache-to=type=registry,ref=${CACHE_TAG} \ - -f Dockerfile.armhf \ + -f docker/Dockerfile.armhf \ --platform ${PI_PLATFORM} \ -t ${IMAGE_NAME}:${TAG} --push . fi +docker images + +# Create multiarch image +# Make sure that all images contained here are pushed to github first. +# Otherwise installation might fail. + +docker manifest create freqtradeorg/freqtrade:${TAG_ORIG} ${IMAGE_NAME}:${TAG_ORIG} ${IMAGE_NAME}:${TAG} +docker manifest push freqtradeorg/freqtrade:${TAG_ORIG} + +docker images + if [ $? -ne 0 ]; then echo "failed building image" return 1 diff --git a/docker/Dockerfile.aarch64 b/docker/Dockerfile.aarch64 index 9f51ba61e..e5d3f0ee9 100644 --- a/docker/Dockerfile.aarch64 +++ b/docker/Dockerfile.aarch64 @@ -11,7 +11,7 @@ ENV FT_APP_ENV="docker" # Prepare environment RUN mkdir /freqtrade \ && apt-get update \ - && apt-get -y install libatlas3-base curl sqlite3 libhdf5-serial-dev sudo \ + && apt-get -y install sudo libatlas3-base curl sqlite3 libhdf5-serial-dev \ && apt-get clean \ && useradd -u 1000 -G sudo -U -m ftuser \ && chown ftuser:ftuser /freqtrade \ @@ -22,8 +22,8 @@ WORKDIR /freqtrade # Install dependencies FROM base as python-deps -RUN apt-get update \ - && apt-get -y install curl build-essential libssl-dev git libffi-dev libgfortran5 pkg-config cmake gcc \ +RUN apt-get update \ + && apt-get -y install build-essential libssl-dev git libffi-dev libgfortran5 pkg-config cmake gcc \ && apt-get clean \ && pip install --upgrade pip diff --git a/Dockerfile.armhf b/docker/Dockerfile.armhf similarity index 90% rename from Dockerfile.armhf rename to docker/Dockerfile.armhf index 9b7986240..8abf0e44b 100644 --- a/Dockerfile.armhf +++ b/docker/Dockerfile.armhf @@ -11,7 +11,7 @@ ENV FT_APP_ENV="docker" # Prepare environment RUN mkdir /freqtrade \ && apt-get update \ - && apt-get -y install libatlas3-base curl sqlite3 libhdf5-serial-dev sudo \ + && apt-get -y install sudo libatlas3-base curl sqlite3 libhdf5-serial-dev \ && apt-get clean \ && useradd -u 1000 -G sudo -U -m ftuser \ && chown ftuser:ftuser /freqtrade \ @@ -22,7 +22,8 @@ WORKDIR /freqtrade # Install dependencies FROM base as python-deps -RUN apt-get -y install build-essential libssl-dev libffi-dev libgfortran5 \ +RUN apt-get update \ + && apt-get -y install build-essential libssl-dev libffi-dev libgfortran5 \ && apt-get clean \ && pip install --upgrade pip \ && echo "[global]\nextra-index-url=https://www.piwheels.org/simple" > /etc/pip.conf