Skip to content

Instantly share code, notes, and snippets.

@anatolinicolae
Last active March 8, 2016 23:58
Show Gist options
  • Save anatolinicolae/3dc6769a943ac27b55a4 to your computer and use it in GitHub Desktop.
Save anatolinicolae/3dc6769a943ac27b55a4 to your computer and use it in GitHub Desktop.
Docked Tomcat installer
#!/bin/sh
set -e
user="$(id -un 2>/dev/null || true)"
if [ "$user" != 'root' ]; then
echo "Please run as root"
exit
fi
# Check if cmd exists
command_exists() {
command -v "$@" > /dev/null 2>&1
}
# Get latest software
apt-get update > /dev/null
# Need curl
if ! command_exists curl; then
apt-get -y install curl > /dev/null
fi
# Need pip
if ! command_exists pip; then
apt-get -y install python-pip > /dev/null
fi
# Install click module
pip install Click > /dev/null
# Install Docker
curl -fsSL https://get.docker.com/ | sh
# Download Tomcat 8 image
docker pull tomcat:jre8
# Download project building helper
curl -fsSL https://git.io/vaUDF > /usr/bin/jsprun
chmod a+x /usr/bin/jsprun
# Copy Tomcat folder from container to system
docker run -dt --name=sqrd_tomcat tomcat:jre8
docker cp sqrd_tomcat:/usr/local/tomcat /usr/local/tomcat
docker stop sqrd_tomcat
docker rm sqrd_tomcat
echo "Everything went fine. Try it!"
@anatolinicolae
Copy link
Author

Run with curl

curl -fsSL https://git.io/vaUAS | sh

or wget

wget -qO- https://git.io/vaUAS | sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment