Ver código fonte

deploy

master
feing 3 meses atrás
pai
commit
1a9164872c
8 arquivos alterados com 183 adições e 0 exclusões
  1. 69
    0
      .drone.yml
  2. 2
    0
      .gitignore
  3. 28
    0
      Dockerfile
  4. 8
    0
      dc-rcsc-web-test.yaml
  5. 8
    0
      dc-rcsc-web.yaml
  6. 54
    0
      default-nginx.conf
  7. 7
    0
      docker-compose-test.yml
  8. 7
    0
      docker-compose.yml

+ 69
- 0
.drone.yml Ver arquivo

@@ -0,0 +1,69 @@
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

+ 2
- 0
.gitignore Ver arquivo

@@ -11,3 +11,5 @@
/dist
/.mfsu
.swc

p

+ 28
- 0
Dockerfile Ver arquivo

@@ -0,0 +1,28 @@
# 使用 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

+ 8
- 0
dc-rcsc-web-test.yaml Ver arquivo

@@ -0,0 +1,8 @@
version: '3.0'
services:
rcsc_web:
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_test_latest
restart: always
ports:
- '8895:80'


+ 8
- 0
dc-rcsc-web.yaml Ver arquivo

@@ -0,0 +1,8 @@
version: '3.0'
services:
rcsc_web:
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_prod_latest
restart: always
ports:
- '8895:80'


+ 54
- 0
default-nginx.conf Ver arquivo

@@ -0,0 +1,54 @@
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;
#}
}


+ 7
- 0
docker-compose-test.yml Ver arquivo

@@ -0,0 +1,7 @@
version: "3.3"
services:
api:
build:
context: .
dockerfile: ./Dockerfile
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_test_latest

+ 7
- 0
docker-compose.yml Ver arquivo

@@ -0,0 +1,7 @@
version: "3.3"
services:
api:
build:
context: .
dockerfile: ./Dockerfile
image: registry.cn-hangzhou.aliyuncs.com/zsanyu/rcsc:rcsc_web_prod_latest

Carregando…
Cancelar
Salvar