-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathbuild.sh
executable file
·46 lines (36 loc) · 1.04 KB
/
build.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
36
37
38
39
40
41
42
43
44
45
#!/bin/bash
set -euo pipefail
name="adamveld12/arma3"
if [[ -f "./keys/id_rsa" && -f "./keys/id_rsa.pub" ]]; then
echo "Using existing keypair..."
else
echo -n "Your ssh password (leave blank for no password) [ENTER]: "
read -es sshpass
echo
echo -n "Generating key pair for SSH in ./keys..."
rm -rf ./keys
mkdir ./keys
ssh-keygen -b 4096 -N "${sshpass}" -f ./keys/id_rsa -C "Arma 3 Admin Server Key" &> /dev/null
fi
if [[ ! -f ./credentials.sh ]]; then
steamuser=""
steampass=""
echo -n "Steam account username? [ENTER]: "
read -e steamuser
echo
echo -n "Steam account password? [ENTER]: "
read -s steampass
echo
echo -e "#!/bin/bash\nexport STEAMUSER=\"${steamuser}\"\nexport STEAMPASS=\"${steampass}\"" > ./credentials.sh
chmod +x ./credentials.sh
fi
echo -e "Building container as \"${name}\"..."
docker build -t ${name} .
if [[ -f $(which boot2docker) ]]; then
IP=$(boot2docker ip)
else
IP=127.0.0.1
fi
echo "${name} completed."
echo "to ssh into your container:"
echo "ssh root@${IP} -i ./keys/id_rsa -p 2222"