Merge pull request #171 from PNUops/feat/sw-center-func-request #99
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: CI/CD Docker to SSH | |
| on: | |
| push: | |
| branches: [main] | |
| jobs: | |
| docker-build-push: | |
| runs-on: ubuntu-latest | |
| environment: Deploy Docker with ssh | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ secrets.DOCKER_IMAGE_NAME }}:latest | |
| build-args: | | |
| VITE_API_BASE_URL=${{ vars.VITE_API_BASE_URL }} | |
| remote-deploy: | |
| needs: docker-build-push | |
| runs-on: ubuntu-latest | |
| environment: Deploy Docker with ssh | |
| steps: | |
| - name: Deploy via SSH | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USER }} | |
| key: ${{ secrets.SSH_KEY }} | |
| script: | | |
| chmod +x ~/pnuops_fe/run.sh | |
| ~/pnuops_fe/run.sh |