-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathassemble
33 lines (25 loc) · 843 Bytes
/
assemble
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
#!/bin/bash
# Copied from the official PHP image and removed extra stuff
cp -R /tmp/src/* ./
if [ -f composer.json ]; then
echo "Found 'composer.json', installing dependencies using composer.phar... "
TEMPFILE=$(mktemp)
RETRIES=6
for ((i=0; i<$RETRIES; i++)); do
if [ -z "$COMPOSER_INSTALLER" ]; then
export COMPOSER_INSTALLER="https://getcomposer.org/installer"
fi
echo "Downloading $COMPOSER_INSTALLER, attempt $((i+1))/$RETRIES"
curl -o $TEMPFILE $COMPOSER_INSTALLER && break
sleep 10
done
if [[ $i == $RETRIES ]]; then
echo "Download failed, giving up."
exit 1
fi
php <$TEMPFILE
./composer.phar install --no-interaction --no-ansi --optimize-autoloader
if [ ! -f composer.lock ]; then
echo -e "\nConsider adding a 'composer.lock' file into your source repository.\n"
fi
fi