You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Install Docker Community Edition](https://www.docker.com/community-edition)
7
7
- (Optional) [Install the Azure CLI](https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-windows?view=azure-cli-latest)
8
8
9
-
## Create app and run it locally
9
+
## Run locally
10
10
11
-
First let's write our app paste the following code into ```main/app.py```:
12
-
13
-
```python
14
-
from flask import Flask
15
-
app = Flask(__name__)
16
-
17
-
@app.route('/')
18
-
defhello_world():
19
-
return'Hello, World!'
20
-
21
-
if__name__=='__main__':
22
-
app.run()
23
-
```
24
-
25
-
Now let's create a dockerfile for the app, we'll use an Alpine Linux container with an NGINX web server. Put the following in a file named `Dockerfile`:
26
-
27
-
```Dockerfile
28
-
FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7
29
-
30
-
ENV LISTEN_PORT=8000
31
-
EXPOSE 8000
32
-
33
-
COPY /app /app
34
-
```
35
-
36
-
Now build and run the docker container:
11
+
To build and run the docker container locally:
37
12
```
38
-
docker build --rm -t flask-quickstart .
39
-
docker run --rm -it -p 8000:8000 flask-quickstart
13
+
docker build --rm -t stackoverflow-flask .
14
+
docker run --rm -it -p 8000:8000 stackoverflow-flask
40
15
```
41
16
42
17
Open a web browser, and navigate to the sample app at ```http://localhost:8000.```
43
18
44
-
You can see the Hello World message from the sample app displayed in the page.
0 commit comments