Skip to content
This repository has been archived by the owner on May 16, 2023. It is now read-only.

Commit

Permalink
Feat - Move repository to ECR (#3)
Browse files Browse the repository at this point in the history
* Feat - Move repository to ECR

* Use makefile in buildspec
  • Loading branch information
Gabriel Pelletier authored Nov 4, 2019
1 parent a404f70 commit 15f0f26
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 7 deletions.
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,25 @@ __check_defined = \
$(error Undefined $1$(if $2, ($2))))

RELEASE_BRANCH=master
VERSION = $(shell git describe --always --tag)
REPOSITORY = quay.io/poka/docker-haraka
GIT_DESCRIBE_TAG = $(shell git describe --always --tag)
VERSION = $(GIT_DESCRIBE_TAG)
CI_ACCOUNT_ID = $(shell aws ssm get-parameter --name organization.accounts.ci.id --query "Parameter.Value" --output text)
ECR_REPOSITORY = $(CI_ACCOUNT_ID).dkr.ecr.us-east-1.amazonaws.com/docker-haraka
THIS_DIR:=$(shell pwd)

version:
@echo $(VERSION)

login_to_ecr:
@$(shell aws ecr get-login --no-include-email --registry-ids $(CI_ACCOUNT_ID) --region us-east-1)

build:
docker build --pull -t $(REPOSITORY):$(VERSION) .
@docker build --pull -t $(ECR_REPOSITORY):$(VERSION) .

push:
docker push $(REPOSITORY):$(VERSION)
push: login_to_ecr
@docker push $(ECR_REPOSITORY):$(VERSION)

generate-changelog:
$(call check_defined, FUTURE_RELEASE, Ex: make generate-changelog FUTURE_RELEASE=v1.0.0)
docker pull prooph/github-changelog-generator
docker run -e CHANGELOG_GITHUB_TOKEN=$(CHANGELOG_GITHUB_TOKEN) -it --rm -v $(THIS_DIR):/app prooph/github-changelog-generator --release-branch=master --no-issues --future-release=$(FUTURE_RELEASE)
@docker pull pokainc/github-changelog-generator
@docker run -e CHANGELOG_GITHUB_TOKEN=$(CHANGELOG_GITHUB_TOKEN) -it --rm -v $(THIS_DIR):/app pokainc/github-changelog-generator --future-release=$(FUTURE_RELEASE)
14 changes: 14 additions & 0 deletions buildspec.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
version: 0.2

phases:
build:
commands:
- make build

post_build:
commands:
- >-
if [ "$CODEBUILD_BUILD_SUCCEEDING" = "0" ]; then
exit 1;
fi
- make push

0 comments on commit 15f0f26

Please sign in to comment.