校验buildx是否有问题
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 57s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 57s
This commit is contained in:
35
.gitea/workflows/buid-push.yml
Normal file
35
.gitea/workflows/buid-push.yml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
name: Build and Push Docker Image
|
||||||
|
|
||||||
|
on: [push] # 在每次 push 时触发
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-and-push:
|
||||||
|
runs-on: ubuntu-latest # 使用 Ubuntu 环境运行
|
||||||
|
steps:
|
||||||
|
# 步骤1: 检出仓库代码
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4 # 使用 Gitea 官方的 checkout action
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
# 步骤2: 登录到 Docker Registry (你的 Gitea 仓库)
|
||||||
|
- name: Log in to Docker Registry
|
||||||
|
uses: docker/login-action@v2
|
||||||
|
with:
|
||||||
|
registry: gitea.zfxt.top
|
||||||
|
username: ${{ secrets.REGISTRY_USERNAME }} # 将用户名存储在仓库的 Secrets 中
|
||||||
|
password: ${{ secrets.REGISTRY_PASSWORD }} # 将密码或个人访问令牌存储在 Secrets 中
|
||||||
|
|
||||||
|
# 步骤3: 构建 Docker 镜像
|
||||||
|
- name: Build and Push Docker Image
|
||||||
|
uses: docker/build-push-action@v5 # 确认此插件可用
|
||||||
|
with:
|
||||||
|
context: ./backend
|
||||||
|
file: ./backend/dockerfile
|
||||||
|
push: true
|
||||||
|
tags: |
|
||||||
|
gitea.zfxt.top/zfxt/bakend:v1.0
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Reference in New Issue
Block a user