Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add script to run both server and builder.

  • Loading branch information...
commit c82699fa81440ca50de15148d93bb7d9e688cd6b 1 parent 0895367
@zsol zsol authored
Showing with 22 additions and 4 deletions.
  1. +1 −4 Dockerfile
  2. +21 −0 run-docker.sh
View
5 Dockerfile
@@ -14,7 +14,4 @@ workdir /home/haskell/hackage-server-master
run cabal install --only-dependencies
run cabal configure && cabal build
-run ./dist/build/hackage-server/hackage-server init --static-dir=datafiles/
-
-entrypoint ["./dist/build/hackage-server/hackage-server", "run", "--static-dir=datafiles/"]
-expose 8080
+cmd echo "Binaries are in ./dist/build/hackage-*"
View
21 run-docker.sh
@@ -0,0 +1,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}"
Please sign in to comment.
Something went wrong with that request. Please try again.