fix: 修正 docker-compose 变量名与 .env.local 一致,还原本地 postgres 服务,清理 .env.ex… #12
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: 构建并部署后端 | |
| on: | |
| push: | |
| branches: [main] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| name: 在服务器上编译并部署 | |
| runs-on: ubuntu-latest | |
| environment: production | |
| steps: | |
| - name: 将源码同步到服务器 | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SERVER_SSH_KEY }} | |
| source: "." | |
| target: "/home/ubuntu/involution-hell" | |
| - name: 在服务器上构建并启动 | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.SERVER_HOST }} | |
| username: ${{ secrets.SERVER_USER }} | |
| key: ${{ secrets.SERVER_SSH_KEY }} | |
| # 命令超时设长一点,Native Image 编译需要时间 | |
| command_timeout: 30m | |
| script: | | |
| cd /home/ubuntu/involution-hell | |
| # 构建新镜像(失败则整个 workflow 标红) | |
| docker build -t involutionhell-backend:latest . | |
| # 用新镜像重启服务 | |
| docker compose up -d --remove-orphans |