diff --git a/Dockerfile b/Dockerfile index 819006bb..312fe0cf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,11 +12,12 @@ RUN apt update -y && apt install python3-pip git -y && pip3 install --no-cache-d ADD Pipfile Pipfile.lock /httpbin/ WORKDIR /httpbin -RUN /bin/bash -c "pip3 install --no-cache-dir -r <(pipenv lock -r)" +RUN /bin/bash -c "pip3 install --no-cache-dir -r <(pipenv requirements)" ADD . /httpbin RUN pip3 install --no-cache-dir /httpbin +RUN chmod +x /httpbin/httpbin.bash EXPOSE 80 -CMD ["gunicorn", "-b", "0.0.0.0:80", "httpbin:app", "-k", "gevent"] +CMD ["/httpbin/httpbin.bash"] diff --git a/README.md b/README.md index 8148d684..b951e69a 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,13 @@ docker pull kennethreitz/httpbin docker run -p 80:80 kennethreitz/httpbin ``` +Some enviroments do not allow to bind to a privileged port. To run it on a +different port instead of port 80, set the environment variables as follows: + +```sh +docker run -e HTTPIN_PORT=8000 -p 8000:8000 kennethreitz/httpbin +``` + See http://httpbin.org for more information. ## Officially Deployed at: diff --git a/httpbin.bash b/httpbin.bash new file mode 100644 index 00000000..6fe976d1 --- /dev/null +++ b/httpbin.bash @@ -0,0 +1,5 @@ +#!/bin/bash +exec gunicorn \ + -b ${HTTPBIN_HOST:-0.0.0.0}:${HTTPBIN_PORT:-80} \ + -k gevent \ + httpbin:app