forked from antonputra/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·29 lines (22 loc) · 1.36 KB
/
build.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
#!/bin/bash
set -x
# setup default values, use environment variables to override
# for example: export VER=0.1.0 && ./build.sh
VER="${VER:-latest}"
REGION="${REGION:-us-east-1}"
ACC="${ACC:-424432388155}"
TARGET_PLATFORM="${TARGET_PLATFORM:-linux/amd64}"
# authenticate with aws
aws ecr get-login-password --region ${REGION} | docker login --username AWS --password-stdin ${ACC}.dkr.ecr.${REGION}.amazonaws.com
# golang service-a
docker build -t ${ACC}.dkr.ecr.${REGION}.amazonaws.com/go-app:service-a-${VER} --platform ${TARGET_PLATFORM} -f go-app/service-a.Dockerfile go-app
docker push ${ACC}.dkr.ecr.${REGION}.amazonaws.com/go-app:service-a-${VER}
# golang service-b
docker build -t ${ACC}.dkr.ecr.${REGION}.amazonaws.com/go-app:service-b-${VER} --platform ${TARGET_PLATFORM} -f go-app/service-b.Dockerfile go-app
docker push ${ACC}.dkr.ecr.${REGION}.amazonaws.com/go-app:service-b-${VER}
# node service-a
docker build -t ${ACC}.dkr.ecr.${REGION}.amazonaws.com/node-app:service-a-${VER} --platform ${TARGET_PLATFORM} -f node-app/service-a.Dockerfile node-app
docker push ${ACC}.dkr.ecr.${REGION}.amazonaws.com/node-app:service-a-${VER}
# node service-b
docker build -t ${ACC}.dkr.ecr.${REGION}.amazonaws.com/node-app:service-b-${VER} --platform ${TARGET_PLATFORM} -f node-app/service-b.Dockerfile node-app
docker push ${ACC}.dkr.ecr.${REGION}.amazonaws.com/node-app:service-b-${VER}