docker 时区设为上海;样式微调 #19
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 推送开发用的 docker 镜像 | |
on: | |
push: | |
branches: | |
- 'develop' | |
env: | |
REGISTRY: ghcr.io | |
IMAGE_NAME: ${{ github.repository }} | |
jobs: | |
push_to_registry: | |
name: 构建并推送 | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
# https://github.com/actions/checkout | |
- name: 拉取代码 | |
uses: actions/checkout@v4 | |
with: | |
ref: develop | |
# https://github.com/docker/login-action | |
- name: 登录到 ghcr | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/docker/metadata-action | |
- name: 提取事件元数据 | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
# https://github.com/docker/setup-buildx-action | |
- name: 使用 buildx 作为构建器 | |
uses: docker/setup-buildx-action@v3 | |
# https://github.com/docker/build-push-action | |
- name: 构建并推送 | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
file: .docker/Dockerfile | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
cache-from: type=gha | |
cache-to: type=gha,mode=max |