Start containers in cloud service by Junh-b #37
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: Start services | |
| run-name: Start containers in cloud service by ${{ github.actor }} | |
| on: | |
| workflow_run: | |
| workflows: [Copy Compose] | |
| types: | |
| - completed | |
| jobs: | |
| start-services: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Connect to cloud server | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{secrets.CLOUD_HOST}} | |
| username: ${{secrets.CLOUD_USERNAME}} | |
| key: ${{secrets.CLOUD_SECRET_KEY}} | |
| port: ${{secrets.CLOUD_PORT}} | |
| script: | | |
| cd ~ | |
| echo "MARIADB_ROOT_PASSWORD=${{ secrets.MARIADB_ROOT_PASSWORD }}" > .env | |
| echo "MARIADB_USER=${{ secrets.MARIADB_USER }}" >> .env | |
| echo "MARIADB_PASSWORD=${{ secrets.MARIADB_PASSWORD }}" >> .env | |
| echo "MARIADB_DATABASE=${{ secrets.MARIADB_DATABASE }}" >> .env | |
| echo "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" >> .env | |
| echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env | |
| sudo docker compose down --volumes | |
| sudo docker container prune -f | |
| sudo docker image prune -a -f | |
| sudo docker compose up -d |