Update Dockerfile #10
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
| # .github/workflows/ci.yml | |
| name: CI Test - Build & Push to ECR | |
| on: | |
| push: | |
| branches: | |
| - develop | |
| - ci/test | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v4 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: ap-northeast-2 | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Build, tag, and push Docker image to ECR | |
| env: | |
| ECR_REGISTRY: 618221165332.dkr.ecr.ap-northeast-2.amazonaws.com | |
| ECR_REPOSITORY: data-server | |
| IMAGE_TAG: ${{ github.sha }} | |
| run: | | |
| docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG . | |
| docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG | |
| - name: Update deployment.yaml in infra repo | |
| env: | |
| ECR_REGISTRY: 618221165332.dkr.ecr.ap-northeast-2.amazonaws.com | |
| ECR_REPOSITORY: data-server | |
| IMAGE_TAG: ${{ github.sha }} | |
| run: | | |
| git clone https://github.com/4-wheel-drive/data-server-infra.git | |
| cd data-server-infra/manifests | |
| sed -i "s#image: .*#image: ${ECR_REGISTRY}/${ECR_REPOSITORY}:${IMAGE_TAG}#" deployment.yaml | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add deployment.yaml | |
| git commit -m "chore: update image tag to ${IMAGE_TAG}" || echo "No changes to commit" | |
| git push https://${{ secrets.INFRA_REPO_PAT }}@github.com/4-wheel-drive/data-server-infra.git |