diff --git a/.woodpecker.yml b/.woodpecker.yml index 1abf406..60391d2 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -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 diff --git a/Dockerfile b/Dockerfile index 10d4e62..282d22d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"]