Skip to content

Commit

Permalink
Commit the first draft
Browse files Browse the repository at this point in the history
  • Loading branch information
lbjeffli committed Nov 16, 2016
1 parent ee9da42 commit 4797f74
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions .idea/inspectionProfiles/profiles_settings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
language: python
python:
- 2.7

services:
- docker

script:
- docker build -t flask-example .
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM python:2.7-alpine
MAINTAINER Jeff Li <[email protected]>

ENV TINI_VERSION v0.13.0
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini /tini
ADD https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini.asc /tini.asc
RUN gpg --keyserver ha.pool.sks-keyservers.net --recv-keys 595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \
&& gpg --verify /tini.asc

COPY . /app
WORKDIR /app

RUN pip install -r requirement.txt

EXPOSE 8080

ENTRYPOINT ["/usr/bin/tini", "--"]
CMD ["gunicorn -w 3 -b :8080 main:app"]
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# docker-gunicorn-example
Using gunicorn to serve flack in a Docker container

To run (at port `8080`):

docker run -p 8080:8080 macinv/gunicorn-example
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello World</title>
</head>
<body>
<h1>'Hello world! This is served by Flask in a Docker container!'</h1>
</body>
</html>
12 changes: 12 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from flask import Flask

app = Flask(__name__, static_folder='')


@app.route('/')
def hello_world():
return app.send_static_file('index.html')


if __name__ == '__main__':
app.run(debug=True, host='0.0.0.0', port=8080)
2 changes: 2 additions & 0 deletions requirement.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Flask==0.10.1
gunicorn==19.4.5

0 comments on commit 4797f74

Please sign in to comment.