Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added multi-arch support for Docker image #5221

Merged
merged 3 commits into from Jun 17, 2022
Merged

Added multi-arch support for Docker image #5221

merged 3 commits into from Jun 17, 2022

Conversation

just5ky
Copy link
Contributor

@just5ky just5ky commented Jun 17, 2022

List of changes

  • Added workflow dispatch to manually trigger this workflow
  • Removed old docker login and build steps
  • Added QEMU for multi-arch compatibilty
  • Image builds using Docker buildx to take advantage of multi-arch

Note:

  • This increases the build time significantly. ~1.5 hours to build for 3 architectures linux/amd64,linux/arm64,linux/arm/v7

Run examples:

https://github.com/Just5KY/siyuan/runs/6928323019 (master branch)
https://github.com/Just5KY/siyuan/runs/6930819023 (Dev branch)

image

@just5ky
Copy link
Contributor Author

just5ky commented Jun 17, 2022

Docker layer caching can also be added, that will allow to use old docker layers again, for next builds, reducing build time.

      - 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: Build and push
        if: ${{ github.ref == 'refs/heads/main' }}
        uses: docker/build-push-action@v2
        with:
          context: .
          push: true
          tags: ${{ secrets.DOCKERHUB_USERNAME }}/${{ secrets.DOCKERHUB_IMAGE_NAME }}:latest
          platforms: linux/amd64,linux/arm/v7,linux/arm64/v8
          cache-from: type=local,src=/tmp/.buildx-cache
          cache-to: type=local,dest=/tmp/.buildx-cache-new

      - name: Move cache
        run: |
          rm -rf /tmp/.buildx-cache
          mv /tmp/.buildx-cache-new /tmp/.buildx-cache

@88250 88250 added this to the 2.0.21 milestone Jun 17, 2022
@88250 88250 merged commit 026d042 into siyuan-note:dev Jun 17, 2022
@just5ky
Copy link
Contributor Author

just5ky commented Jun 17, 2022

@88250 you need to change/add the action secrets, the build is failing becasue of it.

add these in secrets

  • DOCKERHUB_USERNAME
  • DOCKERHUB_TOKEN

@88250
Copy link
Member

88250 commented Jun 17, 2022

@just5ky Thank you, it has been changed in 3cd34c1

@just5ky just5ky deleted the dev branch June 17, 2022 08:13
@just5ky just5ky restored the dev branch June 17, 2022 08:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants