From 10275c121ad131722c72bc4e7f9d09c337f4a9a4 Mon Sep 17 00:00:00 2001 From: herklos Date: Sun, 21 Mar 2021 13:47:42 +0100 Subject: [PATCH 1/6] [Docker] Test armv7 build Related to #1579 --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index bcb04804e..b52f6a03b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -98,7 +98,7 @@ jobs: with: context: . builder: ${{ steps.buildx.outputs.name }} - platforms: linux/amd64 + platforms: linux/amd64,linux/arm/v7 load: true push: false tags: ${{ env.IMAGE }}:${{ env.LATEST }} From 52bcc28bbea5c54c1fcaa3844b13f3894d3ad971 Mon Sep 17 00:00:00 2001 From: Gabriel Gazola Milan Date: Tue, 23 Mar 2021 10:45:25 -0300 Subject: [PATCH 2/6] Remove cryptography rust build --- Dockerfile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 148b4f896..d2907716e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,10 +4,12 @@ FROM python:3.8-slim-buster AS base # requires rustc is required to build cryptography wheel RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential git gcc libffi-dev libssl-dev libxml2-dev libxslt1-dev libxslt-dev libjpeg62-turbo-dev zlib1g-dev \ - && apt-get install -y rustc \ + # && apt-get install -y rustc \ && python -m venv /opt/venv # Make sure we use the virtualenv: +ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 + ENV PATH="/opt/venv/bin:$PATH" COPY . . From 1aef8c54945e5f25b8a3053a38f26d99e4bd1e9a Mon Sep 17 00:00:00 2001 From: Guillaume De Saint Martin Date: Tue, 23 Mar 2021 20:11:20 +0100 Subject: [PATCH 3/6] [Dockerfile] cleanup --- Dockerfile | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index d2907716e..f7eba70f6 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,15 +1,14 @@ FROM python:3.8-slim-buster AS base # requires git to install requirements with git+https -# requires rustc is required to build cryptography wheel RUN apt-get update \ && apt-get install -y --no-install-recommends build-essential git gcc libffi-dev libssl-dev libxml2-dev libxslt1-dev libxslt-dev libjpeg62-turbo-dev zlib1g-dev \ - # && apt-get install -y rustc \ && python -m venv /opt/venv -# Make sure we use the virtualenv: -ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 +# skip cryptography rust compilation (required for armv7 builds) +ENV CRYPTOGRAPHY_DONT_BUILD_RUST=1 +# Make sure we use the virtualenv: ENV PATH="/opt/venv/bin:$PATH" COPY . . From 96f33ece1b69d92c5c753614add5bc796554e596 Mon Sep 17 00:00:00 2001 From: Gabriel Gazola Milan Date: Wed, 24 Mar 2021 08:12:37 -0300 Subject: [PATCH 4/6] Minor changes on GH Docker action --- .github/workflows/docker.yml | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b52f6a03b..5f49105a8 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,10 +2,10 @@ name: OctoBot-Docker on: push: branches: - - 'master' - - 'dev' + - "master" + - "dev" tags: - - '*' + - "*" pull_request: jobs: @@ -58,10 +58,19 @@ jobs: run: exit 1 - name: Set up QEMU - uses: docker/setup-qemu-action@v1 + id: qemu-setup + uses: docker/setup-qemu-action@master + with: + platforms: all + + - name: Print available platforms + run: echo ${{ steps.qemu.outputs.platforms }} - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v1 + id: buildx + uses: docker/setup-buildx-action@master + with: + driver: docker - name: Cache Docker layers uses: actions/cache@v2 @@ -92,14 +101,17 @@ jobs: if: github.event_name == 'push' && steps.wait-for-main-build.outputs.conclusion == 'failure' run: exit 1 - - name: Build and push latest + - name: Build latest if: github.event_name != 'push' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@master with: context: . builder: ${{ steps.buildx.outputs.name }} platforms: linux/amd64,linux/arm/v7 - load: true + # Using "load: true" forces the docker driver. + # Not necessary here, because we set it before. + # ref: https://stackoverflow.com/a/64560710/9944075 + # load: true push: false tags: ${{ env.IMAGE }}:${{ env.LATEST }} build-args: | @@ -134,7 +146,7 @@ jobs: - name: Build and push latest if: github.event_name == 'push' && !startsWith(github.ref, 'refs/tags') && github.ref == 'refs/heads/dev' - uses: docker/build-push-action@v2 + uses: docker/build-push-action@master with: context: . builder: ${{ steps.buildx.outputs.name }} @@ -148,7 +160,7 @@ jobs: - name: Build and push on tag if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') - uses: docker/build-push-action@v2 + uses: docker/build-push-action@master with: context: . file: ./Dockerfile From 3f5042a120f157031ecd66d5e5d5587c7897d335 Mon Sep 17 00:00:00 2001 From: Gabriel Gazola Milan Date: Wed, 24 Mar 2021 08:18:49 -0300 Subject: [PATCH 5/6] Disable caching for testing --- .github/workflows/docker.yml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5f49105a8..f6b421bb9 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -72,13 +72,13 @@ jobs: with: driver: docker - - name: Cache Docker layers - uses: actions/cache@v2 - with: - path: /tmp/.buildx-cache - key: ${{ runner.os }}-buildx-${{ github.sha }} - restore-keys: | - ${{ runner.os }}-buildx- + # - name: Cache Docker layers + # uses: actions/cache@v2 + # with: + # path: /tmp/.buildx-cache + # key: ${{ runner.os }}-buildx-${{ github.sha }} + # restore-keys: | + # ${{ runner.os }}-buildx- - name: Login to DockerHub if: github.event_name == 'push' @@ -116,8 +116,8 @@ jobs: tags: ${{ env.IMAGE }}:${{ env.LATEST }} build-args: | TENTACLES_URL_TAG=${{ env.LATEST }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache - name: Docker build test container if: github.event_name != 'push' @@ -155,8 +155,8 @@ jobs: tags: ${{ env.IMAGE }}:${{ env.LATEST }} build-args: | TENTACLES_URL_TAG=${{ env.LATEST }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache - name: Build and push on tag if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') @@ -171,8 +171,8 @@ jobs: ${{ env.IMAGE }}:${{ env.LATEST }} ${{ env.IMAGE }}:${{ env.STABLE }} ${{ env.IMAGE }}:${{ env.VERSION }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache + # cache-from: type=local,src=/tmp/.buildx-cache + # cache-to: type=local,dest=/tmp/.buildx-cache - name: Image digest run: echo ${{ steps.docker_build_and_psuh.outputs.digest }} From 4c531c2768c62e11de85e9edfeccb7f7cca0c0b4 Mon Sep 17 00:00:00 2001 From: Gabriel Gazola Milan Date: Wed, 24 Mar 2021 08:23:49 -0300 Subject: [PATCH 6/6] Re-enable caching and change docker driver --- .github/workflows/docker.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index f6b421bb9..745e9bbfe 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -70,15 +70,16 @@ jobs: id: buildx uses: docker/setup-buildx-action@master with: - driver: docker + driver: docker-container + use: true - # - name: Cache Docker layers - # uses: actions/cache@v2 - # with: - # path: /tmp/.buildx-cache - # key: ${{ runner.os }}-buildx-${{ github.sha }} - # restore-keys: | - # ${{ runner.os }}-buildx- + - name: Cache Docker layers + uses: actions/cache@v2 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- - name: Login to DockerHub if: github.event_name == 'push' @@ -109,15 +110,15 @@ jobs: builder: ${{ steps.buildx.outputs.name }} platforms: linux/amd64,linux/arm/v7 # Using "load: true" forces the docker driver. - # Not necessary here, because we set it before. - # ref: https://stackoverflow.com/a/64560710/9944075 + # Unfortunately, the "docker" driver does not support + # multi-platform builds. # load: true push: false tags: ${{ env.IMAGE }}:${{ env.LATEST }} build-args: | TENTACLES_URL_TAG=${{ env.LATEST }} - # cache-from: type=local,src=/tmp/.buildx-cache - # cache-to: type=local,dest=/tmp/.buildx-cache + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache - name: Docker build test container if: github.event_name != 'push' @@ -155,8 +156,8 @@ jobs: tags: ${{ env.IMAGE }}:${{ env.LATEST }} build-args: | TENTACLES_URL_TAG=${{ env.LATEST }} - # cache-from: type=local,src=/tmp/.buildx-cache - # cache-to: type=local,dest=/tmp/.buildx-cache + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache - name: Build and push on tag if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') @@ -171,8 +172,8 @@ jobs: ${{ env.IMAGE }}:${{ env.LATEST }} ${{ env.IMAGE }}:${{ env.STABLE }} ${{ env.IMAGE }}:${{ env.VERSION }} - # cache-from: type=local,src=/tmp/.buildx-cache - # cache-to: type=local,dest=/tmp/.buildx-cache + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache - name: Image digest run: echo ${{ steps.docker_build_and_psuh.outputs.digest }}