Last active
March 5, 2021 12:43
-
-
Save saissemet/fffc3e7a9dab071765afe261b7ebd681 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
## Download link: https://we.tl/t-mUDSSDVmff | |
apt update && apt upgrade -y | |
apt install docker.io -y | |
echo "'apache2' or 'nginx'?" | |
read var1 | |
if [[ "$var1" =~ ^([n][g][i][n][x])$ ]] | |
then | |
docker pull saissemet/nginx | |
elif [[ "$var1" =~ ^([a][p][a][c][h][e][2])$ ]] | |
then | |
docker pull saissemet/apache2 | |
fi | |
echo "Specify a name for your container:" | |
read container | |
echo "Specify the port where your website will be running. Try to choose a number between 1024 and 65535:" | |
read port | |
echo "Specify the directory where your 'index.html' will be. It has to be an absolute path:" | |
echo "If you're having any trouble in this step, type 'help'." | |
read path | |
if [[ "$path" =~ ^([h][e][l][p])$ ]] | |
then | |
echo "First, choose a catchphrase for your main website page. It could be anything!" | |
read catchphrase | |
echo "Now you have to choose a directory to support your index file. It will be created if it doesn't exist." | |
echo "Example: '/mywebsitefolder'" | |
read path | |
mkdir $path | |
echo $catchphrase > $path/index.html | |
fi | |
echo "Before you proceed, check all the following information:" | |
echo "Container name: $container" | |
echo "Port: $port" | |
echo "Path: $path" | |
echo "Is this information correct? (y/N)" | |
read confirm | |
if [[ "$confirm" =~ ^([yY][eE][sS]|[yY])$ ]] | |
then | |
docker run --name=$container -d -v $path:/var/www/html -p $port:80 saissemet/$var1 | |
else | |
echo "You're a bad guy" | |
exit 1 | |
fi | |
echo "Thanks for choosing us! " | |
echo "You can access your webserver by browsing your public IP and specified port (IP:PORT)." | |
echo "Here is your index file: 'nano $path/index.html'" | |
echo "Type 'IP' to get your public IP" | |
read ip | |
if [[ "$ip" =~ ^([iI][pP])$ ]] | |
then dig TXT +short o-o.myaddr.l.google.com @ns1.google.com | |
fi | |
exit 1 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment