9 Commits

Author SHA1 Message Date
c18893e6f3 nginx增加了允许跨域 2026-05-04 18:00:58 +08:00
c64d5a96cb fix ci 2026-04-28 19:56:52 +08:00
379bacf023 fix ci 2026-04-28 19:48:40 +08:00
ad2420775e fix ci 2026-04-28 19:48:26 +08:00
fe1a62a7b3 fix ci 2026-04-28 19:37:33 +08:00
bf9f6e5cd5 fix ci 2026-04-28 19:15:10 +08:00
22381f3034 fix 301 2026-04-28 19:06:49 +08:00
16095bdec5 no hash support 2026-04-28 18:52:33 +08:00
73ddcf8372 build-only 2026-04-24 23:26:50 +08:00
3 changed files with 42 additions and 22 deletions

View File

@@ -1,8 +1,8 @@
# action.yml
name: 'build docker image and push to code'
description: 'build docker image and push to simcu code'
name: "build docker image and push to code"
description: "build docker image and push to simcu code"
runs:
using: 'composite'
using: "composite"
steps:
- uses: docker://node:24
with:
@@ -10,18 +10,14 @@ runs:
args: |
-c "export https_proxy=http://100.100.13.14:8118 && \
export http_proxy=http://100.100.13.14:8118 && \
npm pkg set version=${{ github.ref_name }}
npm pkg set version=${{ github.ref_name }} && \
npm ci && \
npm run build"
npm run build-only"
- uses: docker://ubuntu:latest
with:
entrypoint: "/bin/bash"
args: |
-c 'echo "FROM nginx:alpine" > Dockerfile && \
echo "COPY dist /usr/share/nginx/html" >> Dockerfile && \
echo "WORKDIR /usr/share/nginx/html/" >> Dockerfile && \
echo "已经构建完DOCKERFILE了" && \
cat Dockerfile'
-c 'cp "${{ github.action_path }}/nginx.conf" ./ && cp "${{ github.action_path }}/vue.Dockerfile" ./Dockerfile'
- uses: actions/docker-build-push@main

21
nginx.conf Normal file
View File

@@ -0,0 +1,21 @@
server {
listen 80;
root /usr/share/nginx/html;
index index.html;
# 👇 跨域配置开始
add_header Access-Control-Allow-Origin * always;
add_header Access-Control-Allow-Methods 'GET, POST, OPTIONS, PUT, DELETE' always;
add_header Access-Control-Allow-Headers '*, Origin, X-Requested-With, Content-Type, Accept, Authorization, X-Token' always;
add_header Access-Control-Allow-Credentials 'true' always;
# 处理预检 OPTIONS 请求
if ($request_method = 'OPTIONS') {
return 204;
}
# 👆 跨域配置结束
location / {
try_files $uri $uri/ /index.html;
}
}

3
vue.Dockerfile Normal file
View File

@@ -0,0 +1,3 @@
FROM nginx:alpine
COPY dist /usr/share/nginx/html
COPY nginx.conf /etc/nginx/conf.d/default.conf