π Deploy: Vertex AI νκ²½λ³μ μΆκ° #75
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: Docker CI/CD | |
| on: | |
| push: | |
| branches: [ "develop" ] | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to DockerHub | |
| run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin | |
| - name: Build Docker image | |
| run: docker build -t callprotect/backend-server:latest . | |
| - name: Push Docker image | |
| run: docker push callprotect/backend-server:latest | |
| - name: Create .env.prod from secret | |
| run: echo "${{ secrets.ENV_PROD }}" > .env.prod | |
| - name: Copy .env.prod to EC2 | |
| uses: appleboy/scp-action@v0.1.4 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: ".env.prod" | |
| target: "/home/ubuntu/" | |
| debug: true | |
| timeout: 180s | |
| - name: Deploy to EC2 | |
| uses: appleboy/ssh-action@v1 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ubuntu | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| mkdir -p /home/ubuntu/credentials/ | |
| docker pull callprotect/backend-server:latest | |
| docker stop my-app || true && docker rm my-app || true | |
| docker run -d \ | |
| --name my-app \ | |
| --restart always \ | |
| --env-file /home/ubuntu/.env.prod \ | |
| -p 8080:8080 \ | |
| -v /home/ubuntu/credentials/callprotector-stt-key.json:/app/credentials/google-sa-key.json \ | |
| -e GOOGLE_APPLICATION_CREDENTIALS="/app/credentials/google-sa-key.json" \ | |
| -v /home/ubuntu/credentials/callprotector-vertex-ai-key.json:/app/credentials/vertex-ai-key.json \ | |
| -e GOOGLE_APPLICATION_CREDENTIALS_VERTEX_AI="/app/credentials/vertex-ai-key.json" \ | |
| callprotect/backend-server:latest |