-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hardcoretech/feat/v2-action
upgrade action to v2 to support any kind of image tag
- Loading branch information
Showing
4 changed files
with
56 additions
and
5 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
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 @@ | ||
DMC_VERSION = "0.8.0" | ||
|
||
IMAGE_NAME = hardcoretech/django-migration-checker | ||
IMAGE_TAG ?= latest | ||
IMAGE = $(IMAGE_NAME):$(IMAGE_TAG) | ||
|
||
AWS_REGION ?= us-west-2 | ||
AWS_ACCOUNT_ID ?= xxxx | ||
AWS_ECR_REPO = "$(AWS_ACCOUNT_ID).dkr.ecr.$(AWS_REGION).amazonaws.com" | ||
|
||
|
||
.PHONY: build push-to-aws-ecr push-to-docker-hub | ||
|
||
build: | ||
docker build -t $(IMAGE_NAME):$(IMAGE_TAG) --build-arg="VERSION=$(DMC_VERSION)" --platform linux/amd64 . | ||
|
||
push-to-aws-ecr: build | ||
aws ecr describe-repositories --repository-names $(IMAGE_NAME) > /dev/null 2>&1 || aws ecr create-repository --repository-name $(IMAGE_NAME) | ||
aws ecr get-login-password --region $(AWS_REGION) | docker login --username AWS --password-stdin $(AWS_ECR_REPO) | ||
|
||
docker tag $(IMAGE_NAME):$(IMAGE_TAG) ${AWS_ECR_REPO}/$(IMAGE_NAME):$(IMAGE_TAG) | ||
docker push ${AWS_ECR_REPO}/$(IMAGE_NAME):$(IMAGE_TAG) | ||
|
||
push-to-docker-hub: build | ||
docker login | ||
docker push $(IMAGE_NAME):$(IMAGE_TAG) |
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
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