From c0d39da957cecc1e78469590dc4731f1f56cb74c Mon Sep 17 00:00:00 2001 From: Chris Chang Date: Tue, 2 Aug 2016 13:44:44 -0500 Subject: [PATCH] replace makefile with docker-compose (#13) * replace makefile with docker-compose * documentation update * tweak smoketest --- Makefile | 20 -------------------- README.md | 18 ++++++++++++++---- docker-compose.yml | 15 +++++++++++++++ smoketest.sh | 21 +++++---------------- 4 files changed, 34 insertions(+), 40 deletions(-) delete mode 100644 Makefile create mode 100644 docker-compose.yml diff --git a/Makefile b/Makefile deleted file mode 100644 index 8f039dd..0000000 --- a/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -NAME = requestbin - -build: - docker build -t $(NAME) . - -bash: clean - docker run --rm -it --name $(NAME)_1 $(NAME) /bin/sh - -# More env vars -# SESSION_SECRET_KEY -# BUGSNAG_KEY -run: clean - docker run -d --name $(NAME)_redis redis - docker run -d --name $(NAME)_1 \ - --link $(NAME)_redis:redis \ - -e REDIS_URL=redis://redis:6379/0 \ - $(NAME) - -clean: - docker rm -f $(NAME)_1 $(NAME)_redis 2>/dev/null && sleep 1 || true diff --git a/README.md b/README.md index caa0a50..391146b 100644 --- a/README.md +++ b/README.md @@ -8,14 +8,24 @@ Starts a [requestbin](https://github.com/Runscope/requestbin) server on port Usage ----- -This app is designed to work in conjunction with Redis. There's an example in -the Makefile that looks like: +### With Docker-Compose + +If you check out this repository locally or grab the [docker-compose.yml], +you can get a server running on port 8000 quickly with: + + docker-compose up + + [docker-compose.yml]: https://github.com/crccheck/docker-requestbin/blob/master/docker-compose.yml + +### Running a container by hand + +If you wanted to run this manually, it would look something like: docker run -d --name requestbin_redis redis docker run -d --name requestbin \ --link requestbin_redis:redis \ -e REDIS_URL=redis://redis:6379/0 \ - requestbin + crccheck/requestbin Prior Art @@ -25,4 +35,4 @@ Prior Art This image is 1.503 GB, compared to 174 MB for mine. [agaveapi/requestbin](https://registry.hub.docker.com/u/agaveapi/requestbin/): -Not a verified Docker image. +very similar to this project now, only uses a fork. diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..a45eee1 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,15 @@ +version: '2' +services: + redis: + image: redis + requestbin: + image: crccheck/requestbin + # build: . + depends_on: + - redis + environment: + REDIS_URL: redis://redis:6370/0 + # SESSION_SECRET_KEY + # BUGSNAG_KEY + ports: + - "8000:80" diff --git a/smoketest.sh b/smoketest.sh index 2231474..6dff71f 100755 --- a/smoketest.sh +++ b/smoketest.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -container=requestbin_1 +container=requestbin_requestbin_1 set -e @@ -7,24 +7,13 @@ function lookfor { grep --silent "$@" && echo " . . . PASS" || echo " . . . FAIL" } -make run > /dev/null - -IP=$(docker inspect --format '{{.NetworkSettings.IPAddress}}' ${container}) -# make sure we can start a docker container -if [ -z $IP ]; then - echo "Docker container ${container} not currently running" - exit 1 -fi - -sleep 1 +host=localhost:8000 echo -n "Homepage should load" -\curl --silent --head $IP | lookfor "HTTP/1.1 200 OK" +\curl --silent --head ${host} | lookfor "HTTP/1.1 200 OK" echo -n "CSS styles should load" -\curl --silent --head $IP/static/css/bootstrap.css | lookfor "Content-Type: text/css" +\curl --silent --head ${host}/static/css/bootstrap.css | lookfor "Content-Type: text/css" echo -n "Static files should load" -\curl --silent --head $IP/static/img/logo-2x.png | lookfor "Content-Type: image/png" - -make clean > /dev/null +\curl --silent --head ${host}/static/img/logo-2x.png | lookfor "Content-Type: image/png"