Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dockerized tests #517

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
Dockerfile
.git
**

!/httpbin
!/requirements.txt
!/test_httpbin.py
17 changes: 12 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
FROM ubuntu:18.04
FROM python:3-alpine

LABEL name="httpbin"
LABEL version="0.9.2"
LABEL description="A simple HTTP service."
LABEL org.kennethreitz.vendor="Kenneth Reitz"

RUN apt update -y && apt install python3-pip -y
WORKDIR /srv

EXPOSE 80
# until we have precompiled gevent + brotli, we need this:
RUN apk add --no-cache --repository=http://nl.alpinelinux.org/alpine/v3.8/main \
build-base \
gcc \
musl-dev

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

ADD . /httpbin
COPY . .

RUN pip3 install --no-cache-dir gunicorn /httpbin
EXPOSE 80

CMD ["gunicorn", "-b", "0.0.0.0:80", "httpbin:app", "-k", "gevent"]
13 changes: 11 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
version: '2'
services:

# run local httpbin server
httpbin:
build: '.'
build: .
image: httpbin:latest
ports:
- '80:80'
- '80:80'

# run tox-like tests (for python3 only)
unittest:
# reuse already built image
image: httpbin:latest
command: ./test_httpbin.py
8 changes: 8 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
brotli==1.0.6
decorator==4.3.0
flasgger==0.9.1
Flask==1.0.2
gevent==1.3.7
gunicorn==19.9.0
six==1.11.0
Werkzeug==0.14.1