Dockerize #6
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: deploy-to-server | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| deploy-to-server: | |
| timeout-minutes: 60 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18' | |
| steps: | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Build | |
| run: npm run build | |
| - name: Install SSH Key | |
| uses: shimataro/ssh-key-action@v2 | |
| with: | |
| key: ${{ secrets.SSH_DATAFRAMETRAINER_KEY }} | |
| known_hosts: 'just-a-placeholder-to-not-get-errors' | |
| - name: Adding Known Hosts | |
| run: ssh-keyscan -H ${{ secrets.DATAFRAMETRAINER_SERVER_IP }} >> ~/.ssh/known_hosts | |
| working-directory: ./ | |
| - name: Setup tmate session | |
| uses: mxschmitt/action-tmate@v3 | |
| - name: Rsync to server | |
| # run: rsync -avz . dataframetrainer@${{ secrets.DATAFRAMETRAINER_SERVER_IP}}:/home/dataframetrainer/test/ | |
| run: rsync -avz --exclude='.git' --exclude='node_modules' --exclude='plugins' . dataframetrainer@${{ secrets.DATAFRAMETRAINER_SERVER_IP}}:/home/dataframetrainer/test/ | |
| - name: Run docker compose | |
| run: | | |
| ssh dataframetrainer@${{ secrets.DATAFRAMETRAINER_SERVER_IP}} "cd /home/dataframetrainer/test && make down cleanup && make prod_detached" |