Kubernetes/Docker/Dockerfile/Frp/.drone.yml

128 lines
2.7 KiB
YAML
Raw Normal View History

2024-08-07 10:54:39 +00:00
kind: pipeline
type: docker
name: Build Frps
# 手动触发或接口触发
trigger:
event:
- custom
# 指定架构,需在 runner 配置环境变量中指定 DRONE_RUNNER_ARCH,或自动获取
platform:
os: linux
arch: amd64
# 指定运行环境节点,需在 runner 配置环境变量中指定 DRONE_RUNNER_LABELS
node:
City: abroad
# 使用插件构建镜像
steps:
- name: Build Frps
image: plugins/docker
# 仅当本地不存在该镜像时才拉取
pull: if-not-exists
settings:
registry:
from_secret: REGISTRY
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
repo:
from_secret: REPO
# 是否禁止推送镜像
dry_run: false
tags:
- frps
# 要使用的上下文路径,默认为 git 存储库的根目录
context: ./frps
# 要使用的 dockerfile 路径,默认为 git 存储库的根目录
dockerfile: ./frps/Dockerfile
when:
branch:
- main
---
kind: pipeline
type: docker
name: Build Frpc
# 手动触发或接口触发
trigger:
event:
- custom
# 指定架构,需在 runner 配置环境变量中指定 DRONE_RUNNER_ARCH,或自动获取
platform:
os: linux
arch: amd64
# 指定运行环境节点,需在 runner 配置环境变量中指定 DRONE_RUNNER_LABELS
node:
City: abroad
# 使用插件构建镜像
steps:
- name: Build Frpc
image: plugins/docker
# 仅当本地不存在该镜像时才拉取
pull: if-not-exists
settings:
registry:
from_secret: REGISTRY
username:
from_secret: DOCKER_USERNAME
password:
from_secret: DOCKER_PASSWORD
repo:
from_secret: REPO
# 是否禁止推送镜像
dry_run: false
tags:
- frpc
# 要使用的上下文路径,默认为 git 存储库的根目录
context: ./frpc
# 要使用的 dockerfile 路径,默认为 git 存储库的根目录
dockerfile: ./frpc/Dockerfile
when:
branch:
- main
---
kind: pipeline
type: docker
name: Sync Ipsec Vpn Image
trigger:
event:
include:
- custom
# 指定运行环境节点,需在 runner 配置环境变量中指定 DRONE_RUNNER_LABELS
node:
City: abroad
steps:
- name: Sync Ipsec Vpn Image
image: docker:dind
volumes:
- name: dockersock
path: /var/run/docker.sock
environment:
DOCKER_USERNAME:
from_secret: DOCKER_USERNAME
DOCKER_PASSWORD:
from_secret: DOCKER_PASSWORD
REGISTRY:
from_secret: REGISTRY
REPO:
from_secret: REPO
commands:
- docker pull hwdsl2/ipsec-vpn-server
- docker login $REGISTRY -u $DOCKER_USERNAME -p $DOCKER_PASSWORD
- docker tag hwdsl2/ipsec-vpn-server $REPO:ipsec-vpn-server
- docker push $REPO:ipsec-vpn-server
volumes:
- name: dockersock
host:
path: /var/run/docker.sock