25002 / wanx-demo_read-aloud
hono + vue
特点
hono 为 vue 做网管路由,没有使用 nginx。
只适合简单的 demo 部署方式
vue2 在 docker 打包非常坑,会被 node 卡报错!!!
dockerfile
FROM registry.cn-chengdu.aliyuncs.com/qins-img/node:22-alpine AS builder
WORKDIR /app
COPY . .
RUN npm install -g pnpm@10.7.1 --registry=https://registry.npmmirror.com
RUN pnpm install --registry https://registry.npmmirror.com && pnpm build
FROM registry.cn-chengdu.aliyuncs.com/qins-img/node:22-alpine AS runner
WORKDIR /app
COPY --from=builder /app/packages/api/dist /app/dist
COPY --from=builder /app/packages/api/web /app/web
COPY --from=builder /app/packages/api/package.json /app/package.json
RUN npm install --production --registry https://registry.npmmirror.com
EXPOSE 25002
CMD ["node", "/app/dist/index.js"]yml
kind: pipeline
type: docker
name: wanx_机器人_朗读
trigger:
branch:
include:
- master
steps:
- name: 构建并推送镜像
image: plugins/docker
settings:
registry: registry.cn-chengdu.aliyuncs.com
repo: registry.cn-chengdu.aliyuncs.com/qins-img/wanx-demo_read-aloud
tags:
- ${DRONE_BUILD_NUMBER}
username:
from_secret: acr_username
password:
from_secret: acr_password
- name: 部署到服务器
image: appleboy/drone-ssh
settings:
host:
from_secret: ssh_host
username:
from_secret: ssh_user
password:
from_secret: ssh_pwd
port: 22
script:
- echo "开始拉取镜像并重启服务..."
# 使用非交互式登录
# - echo "$acr_password" | docker login -u $acr_username --password-stdin registry.cn-chengdu.aliyuncs.com
# 拉取镜像
- docker pull registry.cn-chengdu.aliyuncs.com/qins-img/wanx-demo_read-aloud:${DRONE_BUILD_NUMBER}
# 停止并删除旧容器
- docker stop wanx-demo_read-aloud || true
- docker rm wanx-demo_read-aloud || true
# 运行新容器
- docker run -dit --name wanx-demo_read-aloud -p 25002:25002 --network nginx-net registry.cn-chengdu.aliyuncs.com/qins-img/wanx-demo_read-aloud:${DRONE_BUILD_NUMBER}
environment:
acr_username:
from_secret: acr_username
acr_password:
from_secret: acr_passwordnginx
server {
listen 80;
listen [::]:80;
server_name w25.q123q.cc;
location /read-aloud/ {
proxy_pass http://wanx-demo_read-aloud:25002;
# 传递必要的请求头
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}