Files
www/.drone.yml
zhuhjay d789438dd9
All checks were successful
continuous-integration/drone/push Build is passing
ci(drone): 更新触发分支为master
- 将流水线触发分支从main更改为master
- 保持工作区共享数据配置不变
2025-11-01 13:45:30 +08:00

63 lines
1.6 KiB
YAML

kind: pipeline
type: docker
name: www
trigger:
event: [push]
branch: [master]
# 使用工作区共享数据
# - 流水线中的临时数据, 等同 ${DRONE_WORKSPACE} => /drone/nuxt-app, 流水线结束后自动销毁
# - 需要显示使用 volumes 配置将其中的临时数据挂在到宿主机, 才能够持久化
workspace:
base: /drone
path: www
steps:
# 打包准备阶段
- name: prepare-artifacts
image: alpine:3.22.2
volumes:
- name: artifacts_mapping
path: /artifacts
- name: timezone_mapping
path: /etc/localtime:ro
commands:
- cd $DRONE_WORKSPACE
- echo ">>> artifacts目录内容:"
- ls -la /artifacts/
- |
# 跟环境变量相关的可能最好不覆盖
cp -n compose.yaml /artifacts/
echo ">>> 最终artifacts目录内容:"
ls -la /artifacts/
# Docker 构建部署阶段
- name: deploy
image: docker:27.5.1-alpine3.21
depends_on: [prepare-artifacts]
environment: # 当前构建的容器使用的环境变量(对于其打包的不起作用奥)
HTTP_PROXY: http://127.0.0.1:7897
HTTPS_PROXY: http://127.0.0.1:7897
NO_PROXY: localhost,127.0.0.1
volumes:
- name: docker_sock_mapping
path: /var/run/docker.sock
- name: timezone_mapping
path: /etc/localtime:ro
commands:
- pwd
- ls -al .
- docker compose build
# 卷配置
volumes:
- name: artifacts_mapping
host:
path: /root/apps/www
- name: docker_sock_mapping
host:
path: /var/run/docker.sock
- name: timezone_mapping
host:
path: /etc/localtime