forked from antonputra/tutorials
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·24 lines (18 loc) · 884 Bytes
/
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
#!/usr/bin/env bash
set -x
# setup default values, use environment variables to override
# export VER=v1 APP_DIR=myapp && ./build.sh
USERNAMR="${USERNAMR:-aputra}"
VER="${VER:-latest}"
LESSON=$(basename $(pwd))
APP_DIR="${APP_DIR:-0}"
DOCKERFILE="${DOCKERFILE:-Dockerfile}"
# service-a
docker build -t ${USERNAMR}/${APP_DIR}-${LESSON}-arm64:${VER} -f ${APP_DIR}/${DOCKERFILE} --platform linux/arm64 ${APP_DIR}
docker build -t ${USERNAMR}/${APP_DIR}-${LESSON}-amd64:${VER} -f ${APP_DIR}/${DOCKERFILE} --platform linux/amd64 ${APP_DIR}
docker push ${USERNAMR}/${APP_DIR}-${LESSON}-arm64:${VER}
docker push ${USERNAMR}/${APP_DIR}-${LESSON}-amd64:${VER}
docker manifest create ${USERNAMR}/${APP_DIR}-${LESSON}:${VER} \
${USERNAMR}/${APP_DIR}-${LESSON}-arm64:${VER} \
${USERNAMR}/${APP_DIR}-${LESSON}-amd64:${VER}
docker manifest push ${USERNAMR}/${APP_DIR}-${LESSON}:${VER}