Skip to content

Instantly share code, notes, and snippets.

@derek-adair
Last active September 28, 2015 16:53
Show Gist options
  • Save derek-adair/632ff71fc148e52973b2 to your computer and use it in GitHub Desktop.
Save derek-adair/632ff71fc148e52973b2 to your computer and use it in GitHub Desktop.
Docker Compose example
from flask import Flask
from redis import Redis
app = Flask(__name__)
redis = Redis(host='redis', port=6379)
@app.route('/')
def hello():
redis.incr('hits')
return 'Hello World! I have been seen %s times.' % redis.get('hits')
if __name__ == "__main__":
app.run(host="0.0.0.0", debug=True)
web:
build: .
ports:
- "5000:5000"
volumes:
- .:/code
links:
- redis
stdin_open: true
redis:
image: redis
FROM python:2.7
ADD . /code
WORKDIR /code
RUN pip install -r requirements.txt
CMD python app.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment