This project is a Docker worker that:
- Clones a Git repository
- Finds the
Dockerfile - Builds a Docker image
- Creates (if needed) a public AWS ECR repository
- Tags and pushes the image
- Writes the full image name into an
output.jsonfile
- Docker installed
- AWS account with
AmazonElasticContainerRegistryPublicFullAccesspermissions - AWS environment variables configured:
export AWS_ACCESS_KEY_ID=xxxx
export AWS_SECRET_ACCESS_KEY=yyyy
export AWS_DEFAULT_REGION=us-east-1docker build -t git-docker-worker-public .docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/results:/results \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e AWS_DEFAULT_REGION=$AWS_DEFAULT_REGION \
git-docker-worker-public \
--git-url https://github.com/USER/REPO.git \
--repo-name my-public-repo \
--tag v1 \
--output /results/output.jsonThe results/output.json file will contain:
{
"image": "public.ecr.aws/<account-id>/my-public-repo:v1"
}docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
-v $(pwd)/results:/results \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e AWS_DEFAULT_REGION=us-east-1 \
git-docker-worker-public \
--git-url https://github.com/docker-library/hello-world.git \
--repo-name hello-world-public \
--tag v1 \
--output /results/output.json