forked from szabodanika/microbin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-setup.sh
executable file
·35 lines (28 loc) · 1.11 KB
/
docker-setup.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
# Check if wget is installed; if not, try to use curl
if ! command -v wget &> /dev/null
then
download_command="curl -O"
else
download_command="wget"
fi
# Get installation directory from user
echo -e "\033[1mEnter installation directory (default is /usr/share/microbin):\033[0m"
read install_dir
install_dir=${install_dir:-/usr/share/microbin}
# Create directory and download files
mkdir -p $install_dir
cd $install_dir
$download_command https://raw.githubusercontent.com/szabodanika/microbin/master/.env
$download_command https://raw.githubusercontent.com/szabodanika/microbin/master/compose.yaml
# Get public path URL and port from user
echo -e "\033[1mEnter public path URL (e.g. https://microbin.myserver.net or http://localhost:8080):\033[0m"
read public_path
echo -e "\033[1mEnter port number (default is 8080):\033[0m"
read port
port=${port:-8080}
# Update environment variables in .env file
sed -i "s|MICROBIN_PUBLIC_PATH=.*|MICROBIN_PUBLIC_PATH=${public_path}|" .env
sed -i "s|MICROBIN_PORT=.*|MICROBIN_PORT=${port}|" .env
# Start Microbin using Docker Compose
docker compose --env-file .env up --detach