Skip to content

Instantly share code, notes, and snippets.

@miguelmota miguelmota/Makefile
Last active Jul 17, 2019

Embed
What would you like to do?
Makefile docker push to AWS Elastic Container Registry (ECR)
# Login to AWS registry (must have docker running)
docker/registry/login:
$$(aws ecr get-login --no-include-email --region us-east-1 --profile=mycompany)
# Build docker target
docker/build:
docker build -f Dockerfile --no-cache -t mycompany/myapp .
# Tag docker image
docker/image/tag:
$(eval REV=$(shell git rev-parse HEAD | cut -c1-7))
docker tag mycompany/myapp:latest 123.dkr.ecr.us-east-1.amazonaws.com/mycompany/myapp:latest
docker tag mycompany/myapp:latest 123.dkr.ecr.us-east-1.amazonaws.com/mycompany/myapp:$(REV)
# Push to registry
docker/registry/push:
$(eval REV=$(shell git rev-parse HEAD | cut -c1-7))
docker push 123.dkr.ecr.us-east-1.amazonaws.com/mycompany/myapp:latest
docker push 123.dkr.ecr.us-east-1.amazonaws.com/mycompany/myapp:$(REV)
# Build docker image and push to AWS registry
docker/build-and-push: docker/registry/login docker/build docker/image/tag docker/registry/push 
@rederlo

This comment has been minimized.

Copy link

commented Jan 11, 2019

saved my life

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.