🎨添加CI

This commit is contained in:
coward 2024-08-20 10:32:14 +08:00
parent 95b3b7ee17
commit 449396d122
4 changed files with 68 additions and 16 deletions

20
.drone.yml Normal file
View File

@ -0,0 +1,20 @@
kind: pipeline
type: docker
name: wireguard-ui
trigger:
event: [tag]
steps:
# 编译演示环境镜像
- name: BuildDevImage
image: plugins/docker
settings:
registry: gitea.mrx.ltd
repo: gitea.mrx.ltd/go-pkg/wireguard-dashboard-admin
username:
from_secret: docker_user
password:
from_secret: docker_pwd
use_cache: true
auto_tag: true

View File

@ -1,21 +1,7 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="7">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
<item index="3" class="java.lang.String" itemvalue="noscript" />
<item index="4" class="java.lang.String" itemvalue="embed" />
<item index="5" class="java.lang.String" itemvalue="script" />
<item index="6" class="java.lang.String" itemvalue="content" />
</list>
</value>
</option>
<option name="myCustomValuesEnabled" value="true" />
</inspection_tool>
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
</profile>
</component>

22
Dockerfile Normal file
View File

@ -0,0 +1,22 @@
# 打包前端
FROM node:18-alpine as build-stage
WORKDIR front
COPY . .
WORKDIR web
RUN corepack enable
RUN corepack prepare pnpm@8.6.10 --activate
RUN npm config set registry https://registry.npmmirror.com
RUN pnpm install
RUN pnpm run build
# 前端集成打包
FROM nginx:alpine
WORKDIR /data
# 替换掉Nginx默认配置
RUN rm /etc/nginx/conf.d/web.conf
ADD docker/web.conf /etc/nginx/conf.d/default.conf
COPY --from=build-stage /front/dist/ ./
# 复制编译后的文件到容器内
RUN /bin/sh -c 'echo init ok'

24
docker/web.conf Normal file
View File

@ -0,0 +1,24 @@
server {
listen 80;
server_name localhost;
proxy_send_timeout 600s; # 设置发送超时时间,
proxy_read_timeout 600s; # 设置读取超时时间。
# 前端打包好的dist目录文件
root /data/;
# 若新增后端路由前缀注意在此处添加(|新增)
location ~* ^/(api) {
client_max_body_size 1000m;
proxy_pass http://wireguard-srv:6687;
# proxy_connect_timeout 15s;
# proxy_send_timeout 15s;
# proxy_read_timeout 15s;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header Host $http_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 http;
}
}