[FIX]: docker compose v2 apply #5
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: CD Pipeline | |
| on: | |
| push: | |
| branches: [ main ] | |
| jobs: | |
| cd: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Create application-secret.yml | |
| run: | | |
| mkdir -p ./temp_secret | |
| echo "${{ secrets.APPLICATION_SECRET }}" > ./temp_secret/application-secret.yml | |
| shell: bash | |
| - name: Copy application-secret.yml to EC2 | |
| uses: appleboy/[email protected] | |
| with: | |
| username: ubuntu | |
| host: ${{ secrets.EC2_HOST }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: ./temp_secret/application-secret.yml | |
| target: /home/ubuntu/secret/ | |
| - name: Copy docker-compose.yml | |
| uses: appleboy/[email protected] | |
| with: | |
| username: ubuntu | |
| host: ${{ secrets.EC2_HOST }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: ./docker-compose.yml | |
| target: /home/ubuntu/cicd/ | |
| - name: Upload deploy.sh to EC2 | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: ./deploy.sh | |
| target: /home/ubuntu/cicd/ | |
| - name: SSH and Deploy | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| echo ${{ secrets.DOCKERHUB_TOKEN }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin | |
| docker pull ${{ secrets.DOCKERHUB_USERNAME }}/assu-app:latest | |
| sudo chmod +x /home/ubuntu/cicd/deploy.sh | |
| sudo /home/ubuntu/cicd/deploy.sh |