ci: switch build from kaniko to docker buildx with registry cache
ci/woodpecker/push/woodpecker Pipeline failed

- build step: kaniko -> woodpeckerci/plugin-docker-buildx
- enable registry layer cache (cache_images) for fast rebuilds
- keep extra_hosts to push over internal network
- Dockerfile: BuildKit pip cache mount + syntax/env tidy

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
jianxinandClaude Opus 4.8 committed 2026-06-19 21:47:27 +08:00
1 parent e81722b8d2
commit 61e43eb885
2 files changed
+16 -19

No files matched your search

+10 -10
View File
@@ -7,25 +7,26 @@ when:
steps:
- name: build
image: woodpeckerci/plugin-kaniko
# 把 registry 域名指到宿主机内网 IP, 镜像层推送走本地不绕公网
image: woodpeckerci/plugin-docker-buildx
# 把 registry 域名指到宿主机内网 IP, 推送走内网不绕公网
backend_options:
docker:
extra_hosts:
- "registry.woni.link:172.19.152.186"
settings:
registry: registry.woni.link
username:
from_secret: registry_username
password:
from_secret: registry_password
repo: registry.woni.link/woni/office-xbot-feishu
tags: latest
repo: woni/office-xbot-feishu
registry: registry.woni.link
cache: true
cache_repo: woni/office-xbot-feishu-cache
mirrors:
- 5c492fmo.mirror.aliyuncs.com
dockerfile: ./Dockerfile
platforms: linux/amd64
mirror: https://5c492fmo.mirror.aliyuncs.com
# 注册表层缓存: requirements 未变时直接命中, 重建很快
cache_images:
- registry.woni.link/woni/office-xbot-feishu:cache
- name: scp
image: appleboy/drone-scp
@@ -53,9 +54,8 @@ steps:
from_secret: ssh_key
script:
- cd /home/docker/office-xbot-feishu
# - sudo sed -i "s#development#production#g" .flaskenv
- docker compose down
- docker compose rm
- docker compose rm -f
- docker compose pull
- docker compose --env-file .env up -d
+6 -9
View File
@@ -1,17 +1,14 @@
# syntax=docker/dockerfile:1
FROM python:3.10-slim
#
ENV PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1
WORKDIR /code
#
COPY ./requirements.txt /code/requirements.txt
#
RUN pip install --no-cache-dir --upgrade -r /code/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
RUN --mount=type=cache,target=/root/.cache/pip \
pip install --upgrade -r /code/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple
#
COPY ./app /code/app
#
# CMD ["python", "/code/app/demo.py"]