name: Build Docker Images
on:
workflow_dispatch:
jobs:
dockerhub:
runs-on: ubuntu-latest
steps:
- name: checkout sources
uses: actions/checkout@v2.3.4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to Docker Hub
uses: docker/login-action@v1.10.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64,linux/s390x,linux/arm/v7
push: true
tags: user/app:latest
Access Token
可以通过Docker Hub的Account Settings->Security->New Access Token创建,然后通过GitHub仓库的Settings->Secrets->New repository secret分别创建DOCKERHUB_USERNAME
和DOCKERHUB_TOKEN
。
tags: user/app:latest
中的user
和app
需要修改为实际的用户名和镜像名。