summaryrefslogtreecommitdiff
path: root/scripts/docker-test.sh
blob: 1cba254f0804e2e0f9362131581a1a8cd6a9a38f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#!/usr/bin/env bash

# A Docker-based test script. It builds the Docker image, starts the container,
# and then waits for the server to be ready. Once the server is ready, it
# makes a request to the server and then kills the container. A 200 response
# code is expected.

set -eux -o pipefail

cleanup() {
  docker-compose kill
}
trap cleanup 0

docker-compose up --build &

while [[ "$(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000/)" -ne "200" ]]; do sleep 5; done
curl -v http://localhost:3000/new/event/public

cleanup