-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdeploy.sh
31 lines (22 loc) · 1.02 KB
/
deploy.sh
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
#!/bin/bash
# SPDX-FileCopyrightText: 2023 Digg - Agency for Digital Government
#
# SPDX-License-Identifier: CC0-1.0
echo ########### Building jar file ###########
gradle build
REGISTRY=[ INSERT_AWS_ACCOUNT_ID ].dkr.ecr.eu-north-1.amazonaws.com
REPO=userrating
TAG=latest
CLUSTER_NAME=user-rating-api
PROFILE=prod
AWS_PROFILE=[ INSERT_AWS_CLI_PROFILE_NAME ]
echo ########### Update local kubectl config ###########
aws eks --region eu-north-1 update-kubeconfig --name ${CLUSTER_NAME} --profile ${AWS_PROFILE}
echo ########### Building docker file ###########
docker build -f Dockerfile.${PROFILE} -t ${REGISTRY}/${REPO} . --platform=linux/amd64
echo ########### Authenticating docker against AWS ECR repository ###########
aws ecr get-login-password --region eu-north-1 --profile ${AWS_PROFILE} | docker login --username AWS --password-stdin ${REGISTRY}
echo ########### Pushing build to repository ###########
docker push ${REGISTRY}/${REPO}:${TAG}
echo ########### Deploying to Kubernetes ###########
kubectl apply -f k8/deployment.yaml