diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..de2a7b8 --- /dev/null +++ b/.drone.yml @@ -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 \ No newline at end of file diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml index 6544ba4..7c4836f 100644 --- a/.idea/inspectionProfiles/Project_Default.xml +++ b/.idea/inspectionProfiles/Project_Default.xml @@ -1,21 +1,7 @@ \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..040849a --- /dev/null +++ b/Dockerfile @@ -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' \ No newline at end of file diff --git a/docker/web.conf b/docker/web.conf new file mode 100644 index 0000000..20a76de --- /dev/null +++ b/docker/web.conf @@ -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; + } +} \ No newline at end of file