feat: add ecr image push github workflows #1
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: Router Image Push | |
| on: | |
| push: | |
| branches: [ master ] | |
| paths: | |
| - 'env-router/**' | |
| workflow_dispatch: | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Configure AWS credentials | |
| uses: aws-actions/configure-aws-credentials@v6.1.0 | |
| with: | |
| aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
| aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
| aws-region: us-east-1 | |
| - name: Login to Amazon ECR | |
| id: login-ecr | |
| uses: aws-actions/amazon-ecr-login@v2 | |
| - name: Get version | |
| id: get_version | |
| run: echo "VERSION=$(cat env-router/VERSION)" >> $GITHUB_OUTPUT | |
| - name: Build, tag, and push image to Amazon ECR | |
| env: | |
| ECR_REGISTRY: 786221173676.dkr.ecr.us-east-1.amazonaws.com | |
| ECR_REPOSITORY: socket-tuner-env-router | |
| IMAGE_TAG: prod-safeguard-${{ steps.get_version.outputs.VERSION }} | |
| run: | | |
| docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG ./env-router | |
| docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG |