Compare commits
2 Commits
fad74df6ac
...
bd29410191
| Author | SHA1 | Date | |
|---|---|---|---|
| bd29410191 | |||
| be315a76cc |
@@ -1,54 +0,0 @@
|
|||||||
# name: Koori-ERP-Demo-Deploy
|
|
||||||
# on:
|
|
||||||
# push:
|
|
||||||
# branches:
|
|
||||||
# - demo
|
|
||||||
|
|
||||||
# jobs:
|
|
||||||
# sync-update:
|
|
||||||
# runs-on: ubuntu-latest
|
|
||||||
# steps:
|
|
||||||
# - name: 1. Checkout New Code
|
|
||||||
# uses: actions/checkout@v3
|
|
||||||
# with:
|
|
||||||
# github-server-url: http://192.168.0.103:3000
|
|
||||||
# repository: ${{ gitea.repository }}
|
|
||||||
# # - name: 1. Checkout New Code
|
|
||||||
# # run: |
|
|
||||||
# # # 進入工作目錄並直接用 git 抓 code,完全不需要 Node
|
|
||||||
# # rm -rf ./*
|
|
||||||
# # git clone -b main http://server:3000/${{ gitea.repository }}.git .
|
|
||||||
|
|
||||||
# - name: 2. Sync Files to Running Container
|
|
||||||
# run: |
|
|
||||||
# # A. 執行複製
|
|
||||||
# cp .env.example .env
|
|
||||||
# sed -i "s|APP_KEY=.*|APP_KEY=${{ secrets.APP_KEY }}|g" .env
|
|
||||||
# # B. 確保容器環境是最新的
|
|
||||||
# # --wait 會確保容器真的跑起來了才執行下一步
|
|
||||||
# docker compose up -d --build --force-recreate --wait
|
|
||||||
|
|
||||||
# # C. 執行精簡化複製 (關鍵優化!)
|
|
||||||
# # 排除 .git, node_modules, vendor 這三大黑洞
|
|
||||||
# tar --exclude='.git' \
|
|
||||||
# --exclude='node_modules' \
|
|
||||||
# --exclude='vendor' \
|
|
||||||
# -cf - . | docker exec -i koori-erp-laravel tar -xf - -C /var/www/html
|
|
||||||
|
|
||||||
# docker exec koori-erp-laravel chown -R 1000:1000 /var/www/html
|
|
||||||
|
|
||||||
|
|
||||||
# - name: 3. Backend & Frontend Build
|
|
||||||
# run: |
|
|
||||||
# docker exec -u 1000:1000 -w /var/www/html koori-erp-laravel sh -c "
|
|
||||||
# composer install --optimize-autoloader &&
|
|
||||||
# npm install &&
|
|
||||||
# npm run build &&
|
|
||||||
# php artisan migrate --force &&
|
|
||||||
# php artisan optimize:clear
|
|
||||||
# "
|
|
||||||
|
|
||||||
# - name: 4. Final Permission Fix
|
|
||||||
# run: |
|
|
||||||
# # 統一修正權限
|
|
||||||
# docker exec koori-erp-laravel chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
|
|
||||||
@@ -35,59 +35,6 @@ jobs:
|
|||||||
if: github.ref == 'refs/heads/main'
|
if: github.ref == 'refs/heads/main'
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
# - name: Checkout Code
|
|
||||||
# uses: actions/checkout@v3
|
|
||||||
# with:
|
|
||||||
# github-server-url: http://192.168.0.103:3000
|
|
||||||
# repository: ${{ github.repository }}
|
|
||||||
|
|
||||||
# # 使用 rsync 透過 2224 Port 推送代碼
|
|
||||||
# - name: Push Code to Production
|
|
||||||
# run: |
|
|
||||||
# # 1. 快速安裝工具
|
|
||||||
# apt-get update && apt-get install -y rsync openssh-client
|
|
||||||
|
|
||||||
# # 2. 準備鑰匙
|
|
||||||
# mkdir -p ~/.ssh
|
|
||||||
# echo "${{ secrets.PROD_SSH_KEY }}" > ~/.ssh/id_rsa_prod
|
|
||||||
# chmod 600 ~/.ssh/id_rsa_prod
|
|
||||||
|
|
||||||
# # 3. 精簡後的同步指令 (只排除 .git)
|
|
||||||
# rsync -avz --delete \
|
|
||||||
# --exclude='.git' \
|
|
||||||
# --exclude='.env' \
|
|
||||||
# -e "ssh -p 2224 -i ~/.ssh/id_rsa_prod -o StrictHostKeyChecking=no" \
|
|
||||||
# ./ root@erp.koori.tw:/var/www/koori-erp-prod/
|
|
||||||
|
|
||||||
# rm ~/.ssh/id_rsa_prod
|
|
||||||
|
|
||||||
|
|
||||||
# # 遠端執行 Docker 指令
|
|
||||||
# - name: Remote Docker Commands
|
|
||||||
# uses: appleboy/ssh-action@master
|
|
||||||
# with:
|
|
||||||
# host: erp.koori.tw
|
|
||||||
# port: 2224 # <--- 這裡指定了 2224 Port
|
|
||||||
# username: root
|
|
||||||
# key: ${{ secrets.PROD_SSH_KEY }}
|
|
||||||
# script: |
|
|
||||||
# cd /var/www/koori-erp-prod
|
|
||||||
# chown -R 1000:1000 .
|
|
||||||
|
|
||||||
# # 2. 啟動容器
|
|
||||||
# WWWGROUP=1000 WWWUSER=1000 docker compose up -d --build --wait
|
|
||||||
|
|
||||||
# # 3. 執行 Laravel 正式環境優化流程
|
|
||||||
# docker exec -u 1000:1000 -w /var/www/html koori-erp-laravel sh -c "
|
|
||||||
# composer install --no-dev --optimize-autoloader &&
|
|
||||||
# npm install &&
|
|
||||||
# npm run build &&
|
|
||||||
# php artisan migrate --force &&
|
|
||||||
# php artisan optimize:clear &&
|
|
||||||
# php artisan optimize
|
|
||||||
# "
|
|
||||||
# docker exec koori-erp-laravel chmod -R 775 /var/www/html/storage /var/www/html/bootstrap/cache
|
|
||||||
# docker restart koori-erp-laravel
|
|
||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
|
|||||||
Reference in New Issue
Block a user