Skip to content

Commit 5e1af1f

Browse files
committedJan 21, 2022
Basic test app
1 parent 7c3062d commit 5e1af1f

File tree

10 files changed

+95
-393
lines changed

10 files changed

+95
-393
lines changed
 

‎.devfile/icon/python.png

5.04 KB
Loading

‎.github/workflows/openshift.yml

-187
This file was deleted.

‎.github/workflows/python-package.yml

-40
This file was deleted.

‎.github/workflows/python-publish.yml

-36
This file was deleted.

‎.gitignore

+2-128
Original file line numberDiff line numberDiff line change
@@ -1,129 +1,3 @@
1-
# Byte-compiled / optimized / DLL files
2-
__pycache__/
3-
*.py[cod]
4-
*$py.class
51

6-
# C extensions
7-
*.so
8-
9-
# Distribution / packaging
10-
.Python
11-
build/
12-
develop-eggs/
13-
dist/
14-
downloads/
15-
eggs/
16-
.eggs/
17-
lib/
18-
lib64/
19-
parts/
20-
sdist/
21-
var/
22-
wheels/
23-
pip-wheel-metadata/
24-
share/python-wheels/
25-
*.egg-info/
26-
.installed.cfg
27-
*.egg
28-
MANIFEST
29-
30-
# PyInstaller
31-
# Usually these files are written by a python script from a template
32-
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33-
*.manifest
34-
*.spec
35-
36-
# Installer logs
37-
pip-log.txt
38-
pip-delete-this-directory.txt
39-
40-
# Unit test / coverage reports
41-
htmlcov/
42-
.tox/
43-
.nox/
44-
.coverage
45-
.coverage.*
46-
.cache
47-
nosetests.xml
48-
coverage.xml
49-
*.cover
50-
*.py,cover
51-
.hypothesis/
52-
.pytest_cache/
53-
54-
# Translations
55-
*.mo
56-
*.pot
57-
58-
# Django stuff:
59-
*.log
60-
local_settings.py
61-
db.sqlite3
62-
db.sqlite3-journal
63-
64-
# Flask stuff:
65-
instance/
66-
.webassets-cache
67-
68-
# Scrapy stuff:
69-
.scrapy
70-
71-
# Sphinx documentation
72-
docs/_build/
73-
74-
# PyBuilder
75-
target/
76-
77-
# Jupyter Notebook
78-
.ipynb_checkpoints
79-
80-
# IPython
81-
profile_default/
82-
ipython_config.py
83-
84-
# pyenv
85-
.python-version
86-
87-
# pipenv
88-
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
89-
# However, in case of collaboration, if having platform-specific dependencies or dependencies
90-
# having no cross-platform support, pipenv may install dependencies that don't work, or not
91-
# install all needed dependencies.
92-
#Pipfile.lock
93-
94-
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
95-
__pypackages__/
96-
97-
# Celery stuff
98-
celerybeat-schedule
99-
celerybeat.pid
100-
101-
# SageMath parsed files
102-
*.sage.py
103-
104-
# Environments
105-
.env
106-
.venv
107-
env/
108-
venv/
109-
ENV/
110-
env.bak/
111-
venv.bak/
112-
113-
# Spyder project settings
114-
.spyderproject
115-
.spyproject
116-
117-
# Rope project settings
118-
.ropeproject
119-
120-
# mkdocs documentation
121-
/site
122-
123-
# mypy
124-
.mypy_cache/
125-
.dmypy.json
126-
dmypy.json
127-
128-
# Pyre type checker
129-
.pyre/
2+
.odo/env
3+
.odo/odo-file-index.json

‎README.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
# flask-app
2-
Testing React app deployment on OpenShift
1+
# devfile-sample-python-basic

‎app.py

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
from flask import Flask
2+
from waitress import serve
3+
4+
app = Flask(__name__)
5+
6+
@app.route('/')
7+
def hello():
8+
return "Hello World!"
9+
10+
if __name__ == '__main__':
11+
serve(app, host='0.0.0.0', port=8080)

‎devfile.yaml

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
schemaVersion: 2.0.0
2+
metadata:
3+
name: python
4+
version: 1.0.0
5+
attributes:
6+
alpha.build-context: .
7+
alpha.build-dockerfile: docker/Dockerfile
8+
starterProjects:
9+
- name: python-example
10+
git:
11+
remotes:
12+
origin: https://github.com/odo-devfiles/python-ex
13+
components:
14+
- name: buildguidance
15+
attributes:
16+
tool: console-import
17+
container:
18+
image: buildguidanceimage-placeholder
19+
memoryLimit: 1024Mi
20+
endpoints:
21+
- name: http-8081
22+
targetPort: 8081
23+
- name: py-web
24+
container:
25+
image: quay.io/eclipse/che-python-3.7:nightly
26+
mountSources: true
27+
endpoints:
28+
- name: web
29+
targetPort: 8080
30+
commands:
31+
- id: pip-install-requirements
32+
exec:
33+
commandLine: pip install --user -r requirements.txt
34+
group:
35+
kind: build
36+
isDefault: true
37+
component: py-web
38+
- id: run-app
39+
exec:
40+
commandLine: "python app.py"
41+
workingDir: ${PROJECTS_ROOT}
42+
component: py-web
43+
group:
44+
kind: run
45+
isDefault: true
46+
- id: debugpy
47+
exec:
48+
commandLine: "pip install --user debugpy && python -m debugpy --listen 0.0.0.0:${DEBUG_PORT} app.py"
49+
workingDir: ${PROJECTS_ROOT}
50+
component: py-web
51+
group:
52+
kind: debug

‎docker/Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
####
2+
# This Dockerfile is used in order to build a container that runs the Spring Boot application
3+
#
4+
# Build the image with:
5+
#
6+
# docker build -f docker/Dockerfile -t python/sample-basic .
7+
#
8+
# Then run the container using:
9+
#
10+
# docker run -i --rm -p 8081:8081 python/sample-basic
11+
####
12+
FROM python:slim
13+
14+
WORKDIR /projects
15+
16+
RUN python3 -m venv venv
17+
RUN . venv/bin/activate
18+
19+
# optimize image caching
20+
COPY requirements.txt .
21+
RUN pip install -r requirements.txt
22+
23+
COPY . .
24+
25+
EXPOSE 8081
26+
CMD [ "waitress-serve", "--port=8081", "app:app"]
27+

‎requirements.txt

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Flask==1.1.2
2+
waitress==2.0.0

0 commit comments

Comments
 (0)
Please sign in to comment.