-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstart-container.sh
executable file
·44 lines (36 loc) · 1.01 KB
/
start-container.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
#!/bin/bash
set -e
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
ENTRYPOINT='--entrypoint="/launch.sh"'
if [ "$1" == "setup" ]; then
IMAGE_VERSION="setup"
OPTS="it -e RUN_SETUP=1"
else
IMAGE_VERSION="latest"
OPTS="dit"
fi
# Check if we want to load in data from a backup volume
if [ -e "$1" ]; then
VOLUMES=`$DIR/backup.py -g $1`
echo "Running with attached volumes: $VOLUMES"
echo
else
VOLUMES=""
fi
# Run the docker instance!
IMAGE_NAME='froxlor'
docker run -$OPTS $ENTRYPOINT \
-p 80:80 -p 443:443 -p :21 \
$VOLUMES \
$IMAGE_NAME:$IMAGE_VERSION
# Finish setup
if [ "$1" == "setup" ]; then
SETUP_CONTAINER=`docker ps -a | grep -m 1 "$IMAGE_NAME:$IMAGE_VERSION" | awk '{print $1;}'`
echo "Tagging $SETUP_CONTAINER as latest"
docker commit $SETUP_CONTAINER $IMAGE_NAME:latest
# echo "Tagging $SETUP_CONTAINER as $VER"
# docker commit $SETUP_CONTAINER $IMAGE_NAME:$VER
echo "Setup complete."
echo " Navigate to http://localhost/froxlor for next step of installation."
echo ""
fi