Changing repo to ECR #14
This file contains 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: ECR sysdig scan and push | |
on: | |
push: | |
branches: [ "main" ] | |
tags: | |
- 'v*' | |
jobs: | |
push_to_registry_and_scan: | |
name: Pushing image to ECR | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@0e613a0980cbf65ed5b322eb7a1e075d28913a83 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@62f4f872db3836360b72999f4b87f1ff13310f3a | |
- name: Build and tag image | |
id: build-image | |
env: | |
IMAGE_TAG: main | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
run: | | |
# Build a docker container | |
docker build -f docker-prerender/Dockerfile -t $ECR_REGISTRY/${{ vars.ECR_REPOSITORY }}:$IMAGE_TAG . | |
- name: Sysdig CLI scanner | |
run: | | |
chmod +x ./scripts/deploy_scan.sh | |
./scripts/deploy_scan.sh | |
continue-on-error: true | |
env: | |
sysdig_api: ${{ secrets.SYSDIG_API }} | |
sysdig_api_url: ${{ vars.SYSDIG_API_URL }} | |
- name: Push image to Amazon ECR | |
id: push-image | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
IMAGE_TAG: main | |
run: | | |
# push it to ECR | |
docker push $ECR_REGISTRY/${{ vars.ECR_REPOSITORY }}:$IMAGE_TAG | |
echo "image=$ECR_REGISTRY/${{ vars.ECR_REPOSITORY }}:$IMAGE_TAG" >> $GITHUB_OUTPUT |