refactor: 彻底移除 docker compose,改用纯 docker 构建+重启部署
Build and Deploy / build (push) Successful in 12s
Build and Deploy / deploy (push) Successful in 26s

This commit is contained in:
cheney
2026-09-01 10:27:11 +08:00
parent e11814048c
commit a5c5d24083
7 changed files with 53 additions and 83 deletions
+14 -10
View File
@@ -3,27 +3,36 @@ name: Build and Deploy
on:
push:
branches: [main]
pull_request:
branches: [main]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build Docker image
run: |
docker build -t awesome-index:latest .
deploy:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Copy files to server
- name: Copy scripts to server
uses: appleboy/scp-action@master
with:
host: 114.134.187.170
username: root
password: ${{ secrets.SERVER_PASSWORD }}
source: "package.json,package-lock.json,src,public,.env.example,start.sh"
source: "start.sh,.env.example"
target: "/app/awesome/"
- name: Deploy and start service
- name: Restart container
uses: appleboy/ssh-action@master
with:
host: 114.134.187.170
@@ -31,10 +40,5 @@ jobs:
password: ${{ secrets.SERVER_PASSWORD }}
script: |
cd /app/awesome
# 如不存在 .env 则从 example 复制
[ ! -f .env ] && cp .env.example .env
# 执行启动脚本
chmod +x start.sh
bash start.sh