Coder Social home page Coder Social logo

Comments (2)

hslr-s avatar hslr-s commented on July 16, 2024 1

您好,哔站看到您的视频有这个需求,正好之前做过多平台构建推送,可以添加一个Github Action工作流,自动化多平台构建,并推送到Docker Hub。 看我的fork: https://github.com/RocCheng/sun-panel/blob/master/.github/workflows/docker.yml 多平台的镜像: https://hub.docker.com/r/roccheng/sun-panel/tags

name: 多平台构建

on: 
  # 触发条件,这里我是手动的,可以配置push自动触发
  # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up QEMU # 模拟器,模拟不同平台
        uses: docker/setup-qemu-action@v2

      - name: Set up Docker Buildx # 通过Buildx,构建多平台
        uses: docker/setup-buildx-action@v2

      - name: Login to Docker Hub # 这里要登陆Docker Hub,需要账户名和一个token,token去Docker Hub生成,然后要在Github项目设置里添加两个secrets,DOCKERHUB_USERNAME 和 DOCKERHUB_TOKEN
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build and push # 构建推送
        uses: docker/build-push-action@v4
        with:
          context: .  # 这里在项目根目录找Dockerfile构建
          platforms: linux/amd64,linux/arm64 # 可配置多个平台
          push: true 
          tags: roccheng/sun-panel # 这里要改成你的Docker Hub 名字

非常感谢你提供的解决方案,正好这几天刚接触到buildx的使用教程,因为之前用的coding持续集成,现在构建多平台,免费时间很短不够用,打算使用虚拟机构建呢,刚好你带来了github的解决方案,方案可用并且很详细,再次感谢。

from sun-panel.

RocCheng avatar RocCheng commented on July 16, 2024

您好,哔站看到您的视频有这个需求,正好之前做过多平台构建推送,可以添加一个Github Action工作流,自动化多平台构建,并推送到Docker Hub。
看我的fork:
https://github.com/RocCheng/sun-panel/blob/master/.github/workflows/docker.yml
多平台的镜像:
https://hub.docker.com/r/roccheng/sun-panel/tags

name: 多平台构建

on: 
  # 触发条件,这里我是手动的,可以配置push自动触发
  # https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#on
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3

      - name: Set up QEMU # 模拟器,模拟不同平台
        uses: docker/setup-qemu-action@v2

      - name: Set up Docker Buildx # 通过Buildx,构建多平台
        uses: docker/setup-buildx-action@v2

      - name: Login to Docker Hub # 这里要登陆Docker Hub,需要账户名和一个token,token去Docker Hub生成,然后要在Github项目设置里添加两个secrets,DOCKERHUB_USERNAME 和 DOCKERHUB_TOKEN
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}

      - name: Build and push # 构建推送
        uses: docker/build-push-action@v4
        with:
          context: .  # 这里在项目根目录找Dockerfile构建
          platforms: linux/amd64,linux/arm64 # 可配置多个平台
          push: true 
          tags: roccheng/sun-panel # 这里要改成你的Docker Hub 名字

from sun-panel.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.