created a template python project with docker-compose integration tests
This commit is contained in:
parent
b08a2eacda
commit
32799b65d5
12
Dockerfile
Normal file
12
Dockerfile
Normal file
|
@ -0,0 +1,12 @@
|
|||
FROM python:2.7
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ADD requirements.txt /app/requirements.txt
|
||||
RUN pip install -r requirements.txt
|
||||
|
||||
ADD app.py /app/app.py
|
||||
|
||||
EXPOSE 80
|
||||
|
||||
CMD ["python", "app.py"]
|
9
Dockerfile.test
Normal file
9
Dockerfile.test
Normal file
|
@ -0,0 +1,9 @@
|
|||
FROM ubuntu:trusty
|
||||
|
||||
RUN apt-get update && apt-get install -yq curl && apt-get clean
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
ADD test.sh /app/test.sh
|
||||
|
||||
CMD ["bash", "test.sh"]
|
16
app.py
Normal file
16
app.py
Normal file
|
@ -0,0 +1,16 @@
|
|||
from flask import Flask
|
||||
from redis import Redis
|
||||
|
||||
app = Flask(__name__)
|
||||
redis = Redis(host="redis")
|
||||
|
||||
@app.route("/")
|
||||
def hello():
|
||||
visits = redis.incr('counter')
|
||||
html = "<h3>Hello World!</h3>" \
|
||||
"<b>Visits:</b> {visits}" \
|
||||
"<br/>"
|
||||
return html.format(visits=visits)
|
||||
|
||||
if __name__ == "__main__":
|
||||
app.run(host="0.0.0.0", port=80)
|
12
docker-compose.test.yml
Normal file
12
docker-compose.test.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
sut:
|
||||
build: .
|
||||
dockerfile: Dockerfile.test
|
||||
links:
|
||||
- web
|
||||
web:
|
||||
build: .
|
||||
dockerfile: Dockerfile
|
||||
links:
|
||||
- redis
|
||||
redis:
|
||||
image: redis
|
9
docker-compose.yml
Normal file
9
docker-compose.yml
Normal file
|
@ -0,0 +1,9 @@
|
|||
web:
|
||||
build: .
|
||||
dockerfile: Dockerfile
|
||||
links:
|
||||
- redis
|
||||
ports:
|
||||
- "80:80"
|
||||
redis:
|
||||
image: redis
|
2
requirements.txt
Normal file
2
requirements.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Flask
|
||||
Redis
|
Loading…
Reference in New Issue
Block a user