This repository has been archived by the owner on Dec 18, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
/
docker-entrypoint-build.sh
executable file
·66 lines (56 loc) · 1.73 KB
/
docker-entrypoint-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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/bash
info () {
printf "\r [\033[00;34mINFO\033[0m] %s\n" "$1"
}
trap exit SIGHUP SIGINT SIGTERM
env | grep -iv PASS | sort
# prepare a tarball of build
if [ "$1" = 'releasetarball' ]; then
info "[Run] Preparing a release tarball"
info "BUILD_VERSION ${BUILD_VERSION}"
info "PROJECT_SOURCE ${PROJECT_SOURCE}"
set -e
rm -rf /app/*
# clone and install the app
set -x
cd /app
git clone --depth=1 --branch="${GIT_BRANCH}" "${PROJECT_SOURCE}" .
git rev-parse HEAD > .version
cat .version
pip install --upgrade "setuptools>=36.0.0,<=37.0.0"
pip install --upgrade -r yabi/runtime-requirements.txt
pip install -e "${PROJECT_NAME}"
pip install -r yabish/requirements.txt
pip install -e yabish
set +x
# vars for creating release tarball
ARTIFACTS="/env
/app/docker-entrypoint.sh
/app/uwsgi
/app/${PROJECT_NAME}
/app/yabish"
TARBALL="/data/${PROJECT_NAME}-${BUILD_VERSION}.tar"
# shellcheck disable=SC2037
TAR_OPTS="--exclude-vcs
--verify
--checkpoint=1000
--checkpoint-action=dot
--create
--preserve-permissions"
info "ARTIFACTS ${ARTIFACTS}"
info "TARBALL ${TARBALL}"
# create tar from / so relative and absolute paths are identical
# allows archive verification to work
cd /
set -x
# shellcheck disable=SC2086
rm -f "${TARBALL}" && tar ${TAR_OPTS} -f "${TARBALL}" ${ARTIFACTS}
set +x
info "$(ls -lath "${TARBALL}")"
rm -f "${TARBALL}.gz" && gzip "${TARBALL}"
info "$(ls -lath "${TARBALL}.gz")"
exit 0
fi
info "[RUN]: Builtin command not provided [releasetarball]"
info "[RUN]: $*"
exec "$@"