尝试使用kaniko actions
This commit is contained in:
parent
1c1bd57c92
commit
131f0c6ba7
@ -9,7 +9,7 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
env:
|
env:
|
||||||
REGISTRY_USER: admin
|
REGISTRY_USERNAME: admin
|
||||||
REGISTRY_PASSWORD: 6nkTT9Th5z6gR?ro
|
REGISTRY_PASSWORD: 6nkTT9Th5z6gR?ro
|
||||||
IMAGE_REGISTRY: hub.docker.xiaohei.one
|
IMAGE_REGISTRY: hub.docker.xiaohei.one
|
||||||
PROJECT_NAME: test-devops
|
PROJECT_NAME: test-devops
|
||||||
@ -24,27 +24,39 @@ jobs:
|
|||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: install podman
|
|
||||||
run: apt update && apt install podman -y
|
|
||||||
|
|
||||||
- name: 创建非特权用户
|
- name: Build and Push
|
||||||
run: |
|
uses: gcr.io/kaniko-project/executor@latest # 使用官方 Kaniko Action
|
||||||
# 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:
|
with:
|
||||||
image: my-new-image
|
context: .
|
||||||
tags: v1 ${{ gitea.sha }}
|
dockerfile: Dockerfile
|
||||||
dockerfiles: |
|
destination: test-devops:0.0.1
|
||||||
./Dockerfile
|
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