Skip to content

Commit 87d09a4

Browse files
committed
Adding docker files
1 parent 948c3cc commit 87d09a4

File tree

4 files changed

+55
-1
lines changed

4 files changed

+55
-1
lines changed

.dockerignore

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
node_modules
2+
npm-debug.log
3+
Dockerfile*
4+
docker-compose*
5+
.dockerignore
6+
.git
7+
.gitignore
8+
README.md
9+
LICENSE
10+
.vscode
11+
__pycache__
12+
env

Dockerfile

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Pull a pre-built alpine docker image with nginx and python3 installed
2+
FROM tiangolo/uwsgi-nginx-flask:python3.6-alpine3.7
3+
4+
# Set the port on which the app runs; make both values the same.
5+
#
6+
# IMPORTANT: When deploying to Azure App Service, go to the App Service on the Azure
7+
# portal, navigate to the Applications Settings blade, and create a setting named
8+
# WEBSITES_PORT with a value that matches the port here (the Azure default is 80).
9+
# You can also create a setting through the App Service Extension in VS Code.
10+
ENV LISTEN_PORT=5000
11+
EXPOSE 5000
12+
13+
# Indicate where uwsgi.ini lives
14+
ENV UWSGI_INI uwsgi.ini
15+
16+
# Tell nginx where static files live. Typically, developers place static files for
17+
# multiple apps in a shared folder, but for the purposes here we can use the one
18+
# app's folder. Note that when multiple apps share a folder, you should create subfolders
19+
# with the same name as the app underneath "static" so there aren't any collisions
20+
# when all those static files are collected together.
21+
ENV STATIC_URL /hello_app/static
22+
23+
# Set the folder where uwsgi looks for the app
24+
WORKDIR /hello_app
25+
26+
# Copy the app contents to the image
27+
COPY . /hello_app
28+
29+
# If you have additional requirements beyond Flask (which is included in the
30+
# base image), generate a requirements.txt file with pip freeze and uncomment
31+
# the next three lines.
32+
#COPY requirements.txt /
33+
#RUN pip install --no-cache-dir -U pip
34+
#RUN pip install --no-cache-dir -r /requirements.txt

README.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
This sample contains the completed program from the tutorial, [Using Flask in Visual Studio Code](https://code.visualstudio.com/docs/python/tutorial-flask). Intermediate steps are not included.
22

3-
Contributions to the sample are welcome. When submitting changes, also consider submitting matching changes to the tutorial, the source file for which is [tutorial-flask.md](https://github.com/Microsoft/vscode-docs/blob/master/docs/python/tutorial-flask.md).
3+
It also contains Dockerfile and uwsgi.ini files necessary to build a container with a production server. The resulting image works both locally and when deployed to Azure App Service.
44

5+
Contributions to the sample are welcome. When submitting changes, also consider submitting matching changes to the tutorial, the source file for which is [tutorial-flask.md](https://github.com/Microsoft/vscode-docs/blob/master/docs/python/tutorial-flask.md).
56

67
# Contributing
78

uwsgi.ini

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[uwsgi]
2+
module = hello_app.webapp
3+
callable = app
4+
uid = 1000
5+
master = true
6+
threads = 2
7+
processes = 4

0 commit comments

Comments
 (0)