Skip to content

Instantly share code, notes, and snippets.

@dbarranco
Created January 7, 2016 10:53
Show Gist options
  • Save dbarranco/5a3e494964deb6d6853d to your computer and use it in GitHub Desktop.
Save dbarranco/5a3e494964deb6d6853d 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
# Start the build with an empty ACI
acbuild --debug begin
# In the event of the script exiting, end the build
trap "{ export EXT=$?; acbuild --debug end && exit $EXT; }" EXIT
# Name the ACI
acbuild --debug set-name example.com/tomcat
# Based on centos
acbuild --debug dep add quay.io/sameersbn/ubuntu
# Install apache and php
acbuild --debug run -- apt-get upgrade
acbuild --debug run -- apt-get update
acbuild --debug run -- apt-get install tomcat7
# Add a port for http traffic on port 80
acbuild --debug port add http tcp 8080
# Add a mount point for files to serve
acbuild --debug mount add html /var/www/localhost/htdocs
# Run apache, and remain in the foreground
acbuild --debug set-exec -- /bin/sh -c "chmod 755 / && /usr/sbin/tomcat -D FOREGROUND"
# Write the result
acbuild --debug write --overwrite tomcat.aci
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment