test-devops/.gitea/workflows/docker-build.yml
xiaohei 5afe903332
Some checks failed
Docker Build / Build and push docker image (push) Failing after 4s
尝试修复
2025-02-16 08:11:39 +08:00

78 lines
1.9 KiB
YAML

name: Docker Build
on:
push:
branches:
- main
pull_request:
branches:
- main
env:
REGISTRY_USERNAME: admin
REGISTRY_PASSWORD: 6nkTT9Th5z6gR?ro
IMAGE_REGISTRY: hub.docker.xiaohei.one
PROJECT_NAME: test-devops
IMAGE_TAGS: ${{ gitea.sha }}
jobs:
build:
name: Build and push docker image
runs-on: ubuntu-22.04
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Build and Push
uses: gcr.io/kaniko-project/executor
with:
context: .
dockerfile: Dockerfile
destination: test-devops:0.0.1
registry: ${{ IMAGE_REGISTRY }}
username: ${{ REGISTRY_USERNAME }}
password: ${{ REGISTRY_PASSWORD }}
# - name: install podman
# run: apt update && apt install podman -y
# - name: 创建非特权用户
# run: |
# # 2. 创建用户 (如果需要)
# adduser podmanuser
# # 3. 配置 subuid/subgid
# echo "podmanuser:100000:65536" >> /etc/subuid
# echo "podmanuser:100000:65536" >> /etc/subgid
# # 4. 切换到非 root 用户
# su - podmanuser
# - uses: redhat-actions/buildah-build@v2
# with:
# image: my-new-image
# tags: v1 ${{ gitea.sha }}
# dockerfiles: |
# ./Dockerfile
# - name: Print to Log
# id: print-to-log
# uses: ./
# with:
# who-to-greet: Test
# - name: Build Docker Image
# run: podman build -t ${{ IMAGE_REGISTRY }}/${{ PROJECT_NAME }}:${{ IMAGE_TAGS }} .
# - name: login to registry
# run: podman login ${{ IMAGE_REGISTRY }} -u ${{ REGISTRY_USER }} -p ${{ REGISTRY_PASSWORD }}
# - name: push to registry
# run: podman push ${{ IMAGE_REGISTRY }}/${{ PROJECT_NAME }}:${{ IMAGE_TAGS }}