-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
45 lines (37 loc) · 1.28 KB
/
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
38
39
40
41
42
43
44
45
AWS_ACCOUNT_ID := 123456789012
AWS_REGION := ca-central-1
DOCKER_DIR := ./docker
TF_MODULE_DIR := ./terragrunt/env/dev
.PHONY: apply cert docker fmt init plan setup
apply: init
@terragrunt apply --terragrunt-working-dir=${TF_MODULE_DIR}
docker:
docker build \
-t ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/zitadel:latest \
-f ${DOCKER_DIR}/Dockerfile ${DOCKER_DIR}
aws ecr get-login-password --region ${AWS_REGION} | docker login \
--username AWS \
--password-stdin ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com
docker push ${AWS_ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com/zitadel:latest
cert:
openssl \
req \
-nodes \
-newkey rsa:2048 \
-x509 -days 3650 \
-keyout ./${DOCKER_DIR}/private.key \
-out ./${DOCKER_DIR}/certificate.crt \
-subj "/C=CA/ST=Ontario/L=Ottawa/O=cds-snc/OU=platform/CN=zitadel.cdssandbox.xyz/[email protected]" &&\
chmod +r ./${DOCKER_DIR}/private.key
fmt:
@terragrunt fmt --terragrunt-working-dir=${TF_MODULE_DIR}
init:
@terragrunt init --terragrunt-working-dir=${TF_MODULE_DIR}
plan: init
@terragrunt plan --terragrunt-working-dir=${TF_MODULE_DIR}
setup: cert init
terragrunt apply \
--target=aws_ecr_repository.zitadel \
--terragrunt-working-dir=${TF_MODULE_DIR} &&\
$(MAKE) docker &&\
$(MAKE) apply