Skip to content

Instantly share code, notes, and snippets.

@patterns
Created January 24, 2018 13:56
Show Gist options
  • Save patterns/b170e16db0e5202e5d79efbbdabf1771 to your computer and use it in GitHub Desktop.
Save patterns/b170e16db0e5202e5d79efbbdabf1771 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
if [ "$EUID" -ne 0 ]; then
echo "This script uses functionality which requires root privileges"
exit 1
fi
acbuild --debug begin
# In the event of the script exiting, end the build
trap "{ export EXT=$?; acbuild --debug end && exit $EXT; }" EXIT
# base image on Bitnami Mini Debian
acbuild --debug dep add quay.io/bitnami/minideb
# Install Wordpress dependencies
acbuild --debug run -- apt update
acbuild --debug run -- install_packages php php-fpm php-cli php-curl php-imap php-mbstring \
php-memcached php-mysql php-mcrypt php-gd php-xml
acbuild --debug run -- install_packages git curl nginx ca-certificates composer \
libnuma-dev php-intl php-pear php-imagick \
php-pspell php-recode php-sqlite3 php-tidy \
php-xmlrpc
# Install WP-CLI
acbuild --debug run -- curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
acbuild --debug run -- /bin/sh -c "chmod +x wp-cli.phar && mv wp-cli.phar /usr/local/bin/wp"
acbuild --debug run mkdir /run/php
acbuild --debug run -- /bin/sh -c "echo 'daemon off;' >> /etc/nginx/nginx.conf"
acbuild --debug copy nginx-default /etc/nginx/sites-available/default
acbuild --debug copy php-fpm.conf /etc/php/7.0/fpm/php-fpm.conf
# Add a port for http traffic on port 80
acbuild --debug port add http tcp 80
# Add a mount point for files to serve
acbuild --debug mount add html /var/www/html
# Run apache, and remain in the foreground
##acbuild --debug set-exec -- /bin/sh -c "chmod 755 / && /usr/sbin/apache2-foreground -D FOREGROUND"
# Write the result
acbuild --debug set-name example.com/compbr
acbuild --debug label add version 0.0.1
acbuild --debug write --overwrite compbr-0.0.1-linux-amd64.aci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment