forked from haskell/hackage-server
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun-docker.sh
executable file
·21 lines (13 loc) · 910 Bytes
/
run-docker.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/bin/sh
set -e
ADMIN_USER=admin
ADMIN_PASS=admin
BUILD_RUN_TIME=30
BUILD_INTERVAL=5
DOCKER_IMAGE=zsol/hackage-server
server_id=$(sudo docker run -d -p 8080 ${DOCKER_IMAGE} sh -c "./dist/build/hackage-server/hackage-server init --static-dir=datafiles --admin=\"${ADMIN_USER}:${ADMIN_PASS}\" ; ./dist/build/hackage-server/hackage-server run --static-dir=datafiles")
server_ip=$(sudo docker inspect $server_id | grep IPAddress | cut -d'"' -f4)
server_local_port=$(sudo docker port $server_id 8080)
sleep 2 # TODO: poll until web server comes up
sudo docker run -d ${DOCKER_IMAGE} sh -c "echo -e \"${ADMIN_USER}\n${ADMIN_PASS}\" | ./dist/build/hackage-build/hackage-build init http://${server_ip}:8080; ./dist/build/hackage-build/hackage-build build --run-time=${BUILD_RUN_TIME} --interval=${BUILD_INTERVAL} --continuous"
echo "You can access your local hackage at http://localhost:${server_local_port}"