kind: pipeline | |||||
type: docker | |||||
name: publish-prod-v1 | |||||
clone: | |||||
disable: true | |||||
steps: | |||||
- name: publish-prod-v1 | |||||
image: scfobao/dronessh:v1 | |||||
settings: | |||||
host: | |||||
- 114.132.85.7 | |||||
username: | |||||
from_secret: SSH_USERNAME | |||||
password: | |||||
from_secret: SSH_PASSWORD | |||||
port: 22 | |||||
command_timeout: 30m | |||||
script: | |||||
- cd /home/lqh/apps/rcsc-web1 | |||||
- git fetch --all | |||||
- git reset --hard origin/master | |||||
# - docker-compose build | |||||
# - docker-compose push | |||||
# - docker pull registry.cn-hangzhou.aliyuncs.com/anyu1/rcsc:rcsc_web_prod_latest | |||||
- docker-compose -f /home/lqh/apps-yml/dc-rcsc-web.yaml up -d --force-recreate | |||||
when: | |||||
branch: | |||||
- master | |||||
--- | |||||
kind: pipeline | |||||
type: docker | |||||
name: publish-test | |||||
clone: | |||||
disable: true | |||||
steps: | |||||
- name: publish-test-build-push | |||||
image: scfobao/dronessh:v1 | |||||
settings: | |||||
host: | |||||
- 114.132.85.7 | |||||
username: | |||||
from_secret: SSH_USERNAME | |||||
password: | |||||
from_secret: SSH_PASSWORD | |||||
port: 22 | |||||
command_timeout: 30m | |||||
script: | |||||
- cd /home/lqh/apps/rcsc-web | |||||
- git fetch --all | |||||
- git reset --hard origin/test | |||||
- docker-compose -f docker-compose-test.yml build | |||||
# - docker-compose -f docker-compose-test.yml push | |||||
# - docker pull registry.cn-hangzhou.aliyuncs.com/anyu1/rcsc:rcsc_web_test_latest | |||||
- sleep 1 | |||||
- docker-compose -f /home/lqh/apps-yml/dc-rcsc-web.yaml up -d --force-recreate | |||||
- docker system prune -f --filter "label!=17" | |||||
when: | |||||
branch: | |||||
- test |
/dist | /dist | ||||
/.mfsu | /.mfsu | ||||
.swc | .swc | ||||
p |
# 使用 Node 作为基础镜像 | |||||
FROM registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:amd64-node-21 as builder | |||||
# 设置工作目录 | |||||
WORKDIR /app | |||||
# 拷贝package.json和package-lock.json | |||||
COPY package*.json ./ | |||||
# 安装依赖 | |||||
RUN npm config set registry https://registry.npmmirror.com && \ | |||||
npm install | |||||
# 将项目文件拷贝到工作目录 | |||||
COPY . . | |||||
# 构建项目 | |||||
RUN npx vite build | |||||
FROM nginx:stable-alpine | |||||
RUN rm -rf /etc/nginx/conf.d/default.conf | |||||
COPY --from=builder /app/dist /usr/share/nginx/html | |||||
COPY --from=builder /app/default-nginx.conf /etc/nginx/conf.d/default.conf | |||||
# 暴露端口 | |||||
EXPOSE 80 |
version: '3.0' | |||||
services: | |||||
rcsc_web: | |||||
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_test_latest | |||||
restart: always | |||||
ports: | |||||
- '8895:80' | |||||
version: '3.0' | |||||
services: | |||||
rcsc_web: | |||||
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_prod_latest | |||||
restart: always | |||||
ports: | |||||
- '8895:80' | |||||
server { | |||||
listen 80; | |||||
listen [::]:80; | |||||
server_name localhost; | |||||
#access_log /var/log/nginx/host.access.log main; | |||||
# location / { | |||||
# root /usr/share/nginx/html; | |||||
# index index.html index.htm; | |||||
# } | |||||
location / { | |||||
root /usr/share/nginx/html; | |||||
index index.html; | |||||
try_files $uri $uri/ @rewrites; | |||||
} | |||||
location @rewrites { | |||||
rewrite ^(.+)$ /index.html last; | |||||
} | |||||
#error_page 404 /404.html; | |||||
# redirect server error pages to the static page /50x.html | |||||
# | |||||
error_page 500 502 503 504 /50x.html; | |||||
location = /50x.html { | |||||
root /usr/share/nginx/html; | |||||
} | |||||
# proxy the PHP scripts to Apache listening on 127.0.0.1:80 | |||||
# | |||||
#location ~ \.php$ { | |||||
# proxy_pass http://127.0.0.1; | |||||
#} | |||||
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 | |||||
# | |||||
#location ~ \.php$ { | |||||
# root html; | |||||
# fastcgi_pass 127.0.0.1:9000; | |||||
# fastcgi_index index.php; | |||||
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; | |||||
# include fastcgi_params; | |||||
#} | |||||
# deny access to .htaccess files, if Apache's document root | |||||
# concurs with nginx's one | |||||
# | |||||
#location ~ /\.ht { | |||||
# deny all; | |||||
#} | |||||
} | |||||
version: "3.3" | |||||
services: | |||||
api: | |||||
build: | |||||
context: . | |||||
dockerfile: ./Dockerfile | |||||
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_test_latest |
version: "3.3" | |||||
services: | |||||
api: | |||||
build: | |||||
context: . | |||||
dockerfile: ./Dockerfile | |||||
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_prod_latest |