Merge pull request #5043 from freqtrade/test_multiarch

Test multiarch
This commit is contained in:
Matthias 2021-05-29 09:44:02 +01:00 committed by GitHub
commit a81a672ffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 38 additions and 22 deletions

View File

@ -3,6 +3,7 @@
Dockerfile Dockerfile
Dockerfile.armhf Dockerfile.armhf
.dockerignore .dockerignore
docker/
.coveragerc .coveragerc
.eggs .eggs
.github .github

View File

@ -374,13 +374,6 @@ jobs:
run: | run: |
echo "${DOCKER_PASSWORD}" | docker login --username ${DOCKER_USERNAME} --password-stdin 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. # We need docker experimental to pull the ARM image.
- name: Switch docker to experimental - name: Switch docker to experimental
run: | run: |
@ -399,10 +392,17 @@ jobs:
- name: Available platforms - name: Available platforms
run: echo ${{ steps.buildx.outputs.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 - name: Build Raspberry docker image
env: env:
IMAGE_NAME: freqtradeorg/freqtrade IMAGE_NAME: freqtradeorg/freqtrade
BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}_pi BRANCH_NAME: ${{ steps.extract_branch.outputs.branch }}
run: | run: |
build_helpers/publish_docker_pi.sh build_helpers/publish_docker_pi.sh

View File

@ -10,8 +10,8 @@ ENV FT_APP_ENV="docker"
# Prepare environment # Prepare environment
RUN mkdir /freqtrade \ RUN mkdir /freqtrade \
&& apt update \ && apt-get update \
&& apt install -y sudo \ && apt-get -y install sudo libatlas3-base curl sqlite3 libhdf5-serial-dev \
&& apt-get clean \ && apt-get clean \
&& useradd -u 1000 -G sudo -U -m ftuser \ && useradd -u 1000 -G sudo -U -m ftuser \
&& chown ftuser:ftuser /freqtrade \ && chown ftuser:ftuser /freqtrade \
@ -23,7 +23,7 @@ WORKDIR /freqtrade
# Install dependencies # Install dependencies
FROM base as python-deps FROM base as python-deps
RUN apt-get update \ RUN apt-get update \
&& apt-get -y install curl build-essential libssl-dev git \ && apt-get -y install build-essential libssl-dev git libffi-dev libgfortran5 pkg-config cmake gcc \
&& apt-get clean \ && apt-get clean \
&& pip install --upgrade pip && pip install --upgrade pip

View File

@ -53,6 +53,7 @@ docker images
docker push ${IMAGE_NAME} docker push ${IMAGE_NAME}
docker push ${IMAGE_NAME}:$TAG_PLOT docker push ${IMAGE_NAME}:$TAG_PLOT
docker push ${IMAGE_NAME}:$TAG docker push ${IMAGE_NAME}:$TAG
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
echo "failed pushing repo" echo "failed pushing repo"
return 1 return 1

View File

@ -3,7 +3,9 @@
# The below assumes a correctly setup docker buildx environment # The below assumes a correctly setup docker buildx environment
# Replace / with _ to create a valid tag # 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" PI_PLATFORM="linux/arm/v7"
echo "Running for ${TAG}" echo "Running for ${TAG}"
CACHE_TAG=freqtradeorg/freqtrade_cache:${TAG}_cache 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" echo "event ${GITHUB_EVENT_NAME}: full rebuild - skipping cache"
docker buildx build \ docker buildx build \
--cache-to=type=registry,ref=${CACHE_TAG} \ --cache-to=type=registry,ref=${CACHE_TAG} \
-f Dockerfile.armhf \ -f docker/Dockerfile.armhf \
--platform ${PI_PLATFORM} \ --platform ${PI_PLATFORM} \
-t ${IMAGE_NAME}:${TAG} --push . -t ${IMAGE_NAME}:${TAG} --push .
else else
@ -25,11 +27,22 @@ else
docker buildx build \ docker buildx build \
--cache-from=type=registry,ref=${CACHE_TAG} \ --cache-from=type=registry,ref=${CACHE_TAG} \
--cache-to=type=registry,ref=${CACHE_TAG} \ --cache-to=type=registry,ref=${CACHE_TAG} \
-f Dockerfile.armhf \ -f docker/Dockerfile.armhf \
--platform ${PI_PLATFORM} \ --platform ${PI_PLATFORM} \
-t ${IMAGE_NAME}:${TAG} --push . -t ${IMAGE_NAME}:${TAG} --push .
fi 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 if [ $? -ne 0 ]; then
echo "failed building image" echo "failed building image"
return 1 return 1

View File

@ -11,7 +11,7 @@ ENV FT_APP_ENV="docker"
# Prepare environment # Prepare environment
RUN mkdir /freqtrade \ RUN mkdir /freqtrade \
&& apt-get update \ && 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 \ && apt-get clean \
&& useradd -u 1000 -G sudo -U -m ftuser \ && useradd -u 1000 -G sudo -U -m ftuser \
&& chown ftuser:ftuser /freqtrade \ && chown ftuser:ftuser /freqtrade \
@ -23,7 +23,7 @@ WORKDIR /freqtrade
# Install dependencies # Install dependencies
FROM base as python-deps FROM base as python-deps
RUN apt-get update \ RUN apt-get update \
&& apt-get -y install curl build-essential libssl-dev git libffi-dev libgfortran5 pkg-config cmake gcc \ && apt-get -y install build-essential libssl-dev git libffi-dev libgfortran5 pkg-config cmake gcc \
&& apt-get clean \ && apt-get clean \
&& pip install --upgrade pip && pip install --upgrade pip

View File

@ -11,7 +11,7 @@ ENV FT_APP_ENV="docker"
# Prepare environment # Prepare environment
RUN mkdir /freqtrade \ RUN mkdir /freqtrade \
&& apt-get update \ && 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 \ && apt-get clean \
&& useradd -u 1000 -G sudo -U -m ftuser \ && useradd -u 1000 -G sudo -U -m ftuser \
&& chown ftuser:ftuser /freqtrade \ && chown ftuser:ftuser /freqtrade \
@ -22,7 +22,8 @@ WORKDIR /freqtrade
# Install dependencies # Install dependencies
FROM base as python-deps 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 \ && apt-get clean \
&& pip install --upgrade pip \ && pip install --upgrade pip \
&& echo "[global]\nextra-index-url=https://www.piwheels.org/simple" > /etc/pip.conf && echo "[global]\nextra-index-url=https://www.piwheels.org/simple" > /etc/pip.conf