-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
/
build.sh
executable file
·25 lines (19 loc) · 922 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
25
#!/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}"
APP_NAME="${APP_NAME:-myapp}"
DOCKERFILE="${DOCKERFILE:-Dockerfile}"
# service-a
docker build -t ${USERNAMR}/${APP_NAME}-${LESSON}-arm64:${VER} -f ${APP_DIR}/${DOCKERFILE} --platform linux/arm64 ${APP_DIR}
docker build -t ${USERNAMR}/${APP_NAME}-${LESSON}-amd64:${VER} -f ${APP_DIR}/${DOCKERFILE} --platform linux/amd64 ${APP_DIR}
docker push ${USERNAMR}/${APP_NAME}-${LESSON}-arm64:${VER}
docker push ${USERNAMR}/${APP_NAME}-${LESSON}-amd64:${VER}
docker manifest create ${USERNAMR}/${APP_NAME}-${LESSON}:${VER} \
${USERNAMR}/${APP_NAME}-${LESSON}-arm64:${VER} \
${USERNAMR}/${APP_NAME}-${LESSON}-amd64:${VER}
docker manifest push ${USERNAMR}/${APP_NAME}-${LESSON}:${VER}