-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
37 lines (27 loc) · 881 Bytes
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
.PHONY: ecrLogin
## AWS ACCOUNT VARS
AWS_REGION := us-east-1
AWS_ACCOUNT_ID := 746466009731
## ECR VARS
ECR_URL := ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
ECR_PW := $(shell aws ecr get-login-password --region ${AWS_REGION})
## GH TOKEN VARS
SECRET_ID := ci-cd
SECRET_PATH := .CKAN_GH_CTREPKA_TOKEN
GH_TOKEN := $(shell aws secretsmanager get-secret-value \
--secret-id ${SECRET_ID} \
--query SecretString \
--output text | \
jq ${SECRET_PATH} | \
tr -d '"')
TAG := default
ecrLogin:
@echo ${ECR_PW} | docker login -u AWS --password-stdin ${ECR_URL}
build: ecrLogin
@docker build ./docker/ckan -t 29_ckan:default --build-arg GH_TOKEN=${GH_TOKEN} --progress plain --no-cache 2>&1 | tee build.log
tag: build
docker tag 29_ckan:default ${ECR_URL}/29_ckan:${TAG}
ecrBuild: tag
ecrPush:
docker push ${ECR_URL}/29_ckan:${TAG}
ecrBuildPush: ecrBuild ecrPush