-
Notifications
You must be signed in to change notification settings - Fork 0
/
sencha
executable file
·40 lines (33 loc) · 1010 Bytes
/
sencha
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
#!/usr/bin/env bash
if [[ -z "${SENCHA_VERSION}" ]]; then
SENCHA_VERSION=latest
fi
WORKDIR=""
VOLUME_HOST=$(pwd -P)
VOLUME_CONT="/code"
while [[ ! -d "${VOLUME_HOST}/.remote-packages" ]]; do
WORKDIR="$(basename ${VOLUME_HOST})/${WORKDIR}"
VOLUME_HOST=$(dirname ${VOLUME_HOST})
if [[ "${VOLUME_HOST}" == "/" ]]; then
WORKDIR=""
VOLUME_HOST=$(pwd -P)
break
fi
done
WORKDIR="${VOLUME_CONT}/${WORKDIR}"
echo "Running sencha via Docker with:"
echo " Version: ${SENCHA_VERSION}"
echo " Volume: ${VOLUME_HOST}:${VOLUME_CONT}"
echo " Workdir: ${WORKDIR}"
TMP_ENV_FILE=$(mktemp)
echo "_JAVA_OPTIONS=-Xms1024m -Xmx2048m" > ${TMP_ENV_FILE}
env | grep -i _PROXY >> ${TMP_ENV_FILE}
SENCHA_LOCKDIR=${VOLUME_HOST}/.sencha.lock
while ! mkdir ${SENCHA_LOCKDIR}; do
sleep 5
done
docker run --rm --env-file ${TMP_ENV_FILE} --volume ${VOLUME_HOST}:${VOLUME_CONT} --workdir ${WORKDIR} poum/senchacmd:${SENCHA_VERSION} $*
EXIT_CODE=$?
rm -rf ${SENCHA_LOCKDIR}
rm ${TMP_ENV_FILE}
exit ${EXIT_CODE}