Last active
March 8, 2016 23:58
-
-
Save anatolinicolae/3dc6769a943ac27b55a4 to your computer and use it in GitHub Desktop.
Docked Tomcat installer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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!" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Run with curl
or wget