Bash script install and uninstall for Docker

This commit is contained in:
Fatih Alp 2023-05-21 17:05:59 +03:00
parent 15aca28ce2
commit f0279bb883
2 changed files with 52 additions and 0 deletions

45
install.sh Normal file
View File

@ -0,0 +1,45 @@
#!/bin/bash
echo "================================================"
echo "----------------- Openclassify -----------------"
echo "----- Automated install script with Docker -----"
echo "================================================"
if [[ $(which docker) && $(docker --version) ]]; then
docker --version
else
#if ubuntu install docker
if [ -n "$(uname -a | grep Ubuntu)" ]; then
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://yum.dockerproject.org/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb https://apt.dockerproject.org/repo/ \
ubuntu-$(lsb_release -cs) \
main"
sudo apt-get update
sudo apt-get -y install docker-engine
# add current user to docker group so there is no need to use sudo when running docker
sudo usermod -aG docker $(whoami)
else
echo "Install docker and come back later"
exit
fi
fi
cp -u .env-sail .env
#docker compose build
#--no-cache
docker compose up --force-recreate -d
docker exec -it oc_php php artisan install --ready
#php artisan migrate --all-addons --force
#composer config http-basic.abc.aaa.com openclassify pass
#composer config repositories.repo-name composer https://abc.aaa.com

7
uninstall.sh Normal file
View File

@ -0,0 +1,7 @@
#!/bin/bash
echo "|| ## Openclassify ## || "
echo "|| Removing Bye bye || "
docker compose down -v
# TODO @fatihalp