Update .github/workflows/pr-build-check.yaml #14
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 Container - Build and Deploy Docker Image | |
| on: | |
| workflow_dispatch: {} | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-deploy: | |
| runs-on: self-hosted # 로컬 Ubuntu의 actions 계정에서 실행됨 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Build and tag Docker image | |
| run: | | |
| docker build --no-cache -t ${{ secrets.DOCKER_HUB_USERNAME }}/control_deploy:latest . | |
| docker tag ${{ secrets.DOCKER_HUB_USERNAME }}/control_deploy:latest ${{ secrets.DOCKER_HUB_USERNAME }}/control_deploy:latest | |
| - name: Deploy container locally | |
| run: | | |
| IMAGE=${{ secrets.DOCKER_HUB_USERNAME }}/control_dev:latest | |
| docker stop CONTROL_DEPLOY || true | |
| docker rm CONTROL_DEPLOY || true | |
| docker run -d --name CONTROL_DEPLOY -p 8083:8081 --restart=always \ | |
| --add-host host.docker.internal:host-gateway \ | |
| -e CORES="${{ secrets.CORES }}" \ | |
| -e DB_USER="${{ secrets.DB_USER }}" \ | |
| -e DB_PASSWORD="${{ secrets.DB_PASSWORD }}" \ | |
| -e DB_HOST="${{ secrets.DB_HOST }}" \ | |
| -e DB_NAME="${{ secrets.DB_NAME }}" \ | |
| -e GUAC_DB_USER="${{ secrets.GUAC_DB_USER }}" \ | |
| -e GUAC_DB_PASSWORD="${{ secrets.GUAC_DB_PASSWORD }}" \ | |
| -e GUAC_DB_HOST="${{ secrets.GUAC_DB_HOST }}" \ | |
| -e GUAC_DB_NAME="${{ secrets.GUAC_DB_NAME }}" \ | |
| -e REDIS_HOST="${{ secrets.REDIS_HOST }}" \ | |
| -e CMS_HOST="${{ secrets.CMS_HOST }}" \ | |
| -e GUAC_BASE_URL="${{ secrets.GUAC_BASE_URL }}" \ | |
| $IMAGE | |
| docker system prune -af |