chore: adding boiler plate to ssh key config #26
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: build-and-deploy-tarball | |
| on: | |
| push: | |
| branches: ["master", "ci/cd-implementation"] | |
| jobs: | |
| build-and-deploy-tarball: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| - name: setup for docker building tools | |
| uses: docker/setup-buildx-action@v3 | |
| - name: install utilities | |
| run: | | |
| sudo apt-get install docker-compose | |
| - name: create .env for remote | |
| run: | | |
| cat > .env <<EOF | |
| BACKEND_PORT=${{ secrets.BACKEND_PORT }} | |
| WEBVIEW_PORT=${{ secrets.WEBVIEW_PORT }} | |
| VITE_BACKEND_URL=${{ secrets.VITE_BACKEND_URL }} | |
| BACKEND_HOST=${{ secrets.BACKEND_HOST }} | |
| WEBVIEW_URL=${{ secrets.WEBVIEW_URL }} | |
| EOF | |
| - name: build images | |
| run: | | |
| docker-compose -f building.yml build | |
| - name: save image | |
| run: | | |
| mkdir images | |
| docker save milk-folio_backend:latest milk-folio_webview:latest > ./images/images.tar | |
| # this for the deployment of the images | |
| - name: Install SSH Key | |
| uses: shimataro/ssh-key-action@v2 | |
| with: | |
| key: ${{ secrets.VPS_SSH_KEY }} | |
| known_hosts: 'PlaceHolder' | |
| - name: Adding Known Hosts | |
| run: ssh-keyscan -H ${{ secrets.VPS_HOST }} >> ~/.ssh/known_hosts | |
| - name: Deploy with rsync | |
| run: rsync -avhPW --progress ./images/ ${{ secrets.VPS_USER }}@${{ secrets.VPS_HOST }}:/home/ec2-user/ |