尝试使用kaniko actions
This commit is contained in:
parent
1c1bd57c92
commit
131f0c6ba7
@ -9,7 +9,7 @@ on:
|
||||
- main
|
||||
|
||||
env:
|
||||
REGISTRY_USER: admin
|
||||
REGISTRY_USERNAME: admin
|
||||
REGISTRY_PASSWORD: 6nkTT9Th5z6gR?ro
|
||||
IMAGE_REGISTRY: hub.docker.xiaohei.one
|
||||
PROJECT_NAME: test-devops
|
||||
@ -24,27 +24,39 @@ jobs:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- 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
|
||||
- name: Build and Push
|
||||
uses: gcr.io/kaniko-project/executor@latest # 使用官方 Kaniko Action
|
||||
with:
|
||||
image: my-new-image
|
||||
tags: v1 ${{ gitea.sha }}
|
||||
dockerfiles: |
|
||||
./Dockerfile
|
||||
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
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user