All in one web stack for use in bitbucket pipelines
3.5K
This image is intended to be used as part of a bitbucket pipeline.
It acts as an "all-in-one" box and you'll generally need to enable some services and configure them as part of starting your pipeline build.
Example setup commands that are compatible with typical other Phase2 images.
#!/bin/bash
# Copy/create drush aliases
mkdir /root/.drush
cp env/bitbucket/root/.drush/aliases.drushrc.php /root/.drush/
# Fake sendmail's presence so site installs don't report failure on sending mail
ln -s /bin/true /usr/sbin/sendmail
/etc/init.d/mysql start
# give mysql time to start, this is less elegant than checking and waiting
# until it has started but quick to work at the expense of waiting longer
# than probably needed
sleep 10
mysql -e "CREATE user 'DESIRED_USER'@'%' IDENTIFIED BY 'DESIRED_PASSWORD'"
mysql -e "GRANT ALL PRIVILEGES ON *.* to 'DESIRED_USER'@'%' WITH GRANT OPTION"
# Make up for lack of docker and dnsdock fanciness
echo "127.0.0.1 db NORMAL_HOSTNAME" >> /etc/hosts
# setup directories to point in the right ways since
# in pipelines codebase is located in something like
# /opt/atlassian/bitbucketci/agent/build/ instead of
# mounted to /var/www
mv /var/www /var/www.orig
ln -s $PWD /var/www
# start up remaining services
/etc/init.d/php7.0-fpm start
/etc/init.d/apache2 start
/etc/init.d/varnish start
After those commands one would typically run something like the following to actually perform an install and tests.
#!/bin/bash
# error on any failed command
set -e
# Handler for errors or other interruptions.
cancel() {
echo "Error: Line $1: $2"
# pass failure back out to pipelines
exit 1
}
# Abort build step on errors.
trap 'cancel $LINENO $BASH_COMMAND' ERR
export COMPOSER_ALLOW_SUPERUSER=1
TEMPFILE=$(mktemp)
# Fix typical fix-perms.sh script (if you have it run automatically) to
# take care of difference between Phase2 image user/group for apache
# and one from bitbucket base image
sed 's/apache/www-data/g' bin/fix-perms.sh > $TEMPFILE
mv $TEMPFILE bin/fix-perms.sh
chmod 0755 bin/fix-perms.sh
# Install the codebase
npm install --unsafe-perm --no-progress
grunt --timer --quiet
grunt install --no-db-load
# This appears to be needed before behat tests and such can run
grunt cache-clear
# Actually do the tests
grunt test
Happy pipelining.
Content type
Image
Digest
Size
849 MB
Last updated
about 10 years ago
docker pull phase2/bitbucket-build