replace makefile with docker-compose (#13)
* replace makefile with docker-compose * documentation update * tweak smoketest
This commit is contained in:
parent
63f4ba7be2
commit
c0d39da957
20
Makefile
20
Makefile
@ -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
|
18
README.md
18
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.
|
||||
|
15
docker-compose.yml
Normal file
15
docker-compose.yml
Normal file
@ -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"
|
21
smoketest.sh
21
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"
|
||||
|
Loading…
x
Reference in New Issue
Block a user