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

Compose app samples from the application-template repo #2

Merged
merged 14 commits into from
Mar 5, 2020
Prev Previous commit
Next Next commit
add nginx-flask-mysql application sample
Signed-off-by: Anca Iordache <anca.iordache@docker.com>
  • Loading branch information
Anca Iordache committed Mar 5, 2020
commit a410c8bc62e197456b2264c764daf046dbf643bb
10 changes: 10 additions & 0 deletions samples/nginx-flask-mysql/backend/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.6-alpine3.7
EXPOSE 5000
ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
ADD requirements.txt /code/
RUN pip install -r requirements.txt
ADD . /code/
ENV FLASK_APP hello.py
CMD flask run --host=0.0.0.0
6 changes: 6 additions & 0 deletions samples/nginx-flask-mysql/backend/hello.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
from flask import Flask
app = Flask(__name__)

@app.route('/')
def hello_world():
return 'Hello world'
6 changes: 6 additions & 0 deletions samples/nginx-flask-mysql/backend/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
click==6.7
Flask==1.0.2
itsdangerous==0.24
Jinja2==2.10
MarkupSafe==1.0
Werkzeug==0.14.1
1 change: 1 addition & 0 deletions samples/nginx-flask-mysql/db/password.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
db-78n9n
27 changes: 27 additions & 0 deletions samples/nginx-flask-mysql/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
version: "3.7"
services:
backend:
build: backend
depends_on:
- db
db:
environment:
MYSQL_DATABASE: example
MYSQL_ROOT_PASSWORD_FILE: /run/secrets/db-password
image: mysql:5.7
restart: always
secrets:
- db-password
volumes:
- db-data:/var/lib/mysql
proxy:
build: proxy
ports:
- 80:80
depends_on:
- backend
volumes:
db-data: {}
secrets:
db-password:
file: db/password.txt
2 changes: 2 additions & 0 deletions samples/nginx-flask-mysql/proxy/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
FROM nginx:1.13-alpine
COPY conf /etc/nginx/conf.d/default.conf
8 changes: 8 additions & 0 deletions samples/nginx-flask-mysql/proxy/conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
server {
listen 80;
server_name localhost;
location / {
proxy_pass http://backend:5000;
}

}