-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit cfbab71
Showing
2 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Docker Image CI/CD to ECR | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # Adjust the branch name as needed | ||
|
||
jobs: | ||
build-and-push-images: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v1 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: <your-region> | ||
|
||
- name: Run Docker image push script | ||
run: | | ||
chmod +x push_images_to_ecr.sh | ||
./scripts.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#!/bin/bash | ||
|
||
# Define the list of images to pull and push | ||
IMAGES=( | ||
securecodebox/engine | ||
securecodebox/nmap | ||
securecodebox/zap | ||
securecodebox/nikto | ||
securecodebox/sslyze | ||
securecodebox/bodgeit | ||
securecodebox/amass | ||
securecodebox/arachni | ||
securecodebox/ssh | ||
securecodebox/lurcher | ||
securecodebox/hook-teams-notification | ||
) | ||
|
||
AWS_REGION="us-east-1" | ||
ECR_URI="353472581086.dkr.ecr.us-east-1.amazonaws.com/dk-securecodebox" | ||
|
||
aws configure set aws_access_key_id $AWS_ACCESS_KEY_ID | ||
aws configure set aws_secret_access_key $AWS_SECRET_ACCESS_KEY | ||
aws configure set default.region $AWS_REGION | ||
|
||
$(aws ecr get-login --no-include-email --region $AWS_REGION) | ||
|
||
for IMAGE in "${IMAGES[@]}"; do | ||
docker pull $IMAGE:latest | ||
NEW_TAG="$ECR_URI:$(basename $IMAGE)-latest" | ||
docker tag $IMAGE:latest $NEW_TAG | ||
docker push $NEW_TAG | ||
done | ||
|
||
|