Skip to content

Commit 2a6a526

Browse files
committed
Add 2.2.0 and 3.1.0 versions
Signed-off-by: Dmytro Nochevnov <[email protected]>
1 parent 54b1741 commit 2a6a526

File tree

7 files changed

+222
-8
lines changed

7 files changed

+222
-8
lines changed

stacks/python/2.1.0/devfile.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
schemaVersion: 2.2.2
1+
schemaVersion: 2.1.0
22
metadata:
33
name: python
44
displayName: Python
@@ -28,9 +28,8 @@ components:
2828
args: ['tail', '-f', '/dev/null']
2929
mountSources: true
3030
endpoints:
31-
- name: https-python
31+
- name: http-python
3232
targetPort: 8080
33-
protocol: https
3433
- exposure: none
3534
name: debug
3635
targetPort: 5858

stacks/python/2.2.0/devfile.yaml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
schemaVersion: 2.2.2
2+
metadata:
3+
name: python
4+
displayName: Python
5+
description: "Python (version 3.9.x) is an interpreted, object-oriented, high-level programming language with dynamic semantics.
6+
Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together."
7+
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/python.svg
8+
tags:
9+
- Python
10+
- Pip
11+
- Flask
12+
projectType: Python
13+
language: Python
14+
provider: Red Hat
15+
version: 2.2.0
16+
starterProjects:
17+
- name: flask-example
18+
description:
19+
'Flask is a web framework, it’s a Python module that lets you develop web applications easily.
20+
It’s has a small and easy-to-extend core: it’s a microframework that doesn’t include an ORM (Object Relational Manager) or such features.'
21+
git:
22+
remotes:
23+
origin: https://github.com/devfile-samples/python-ex
24+
components:
25+
- name: py
26+
container:
27+
image: registry.access.redhat.com/ubi9/python-39:1-172
28+
args: ['tail', '-f', '/dev/null']
29+
mountSources: true
30+
endpoints:
31+
- name: https-python
32+
targetPort: 8080
33+
protocol: https
34+
- exposure: none
35+
name: debug
36+
targetPort: 5858
37+
env:
38+
- name: DEBUG_PORT
39+
value: '5858'
40+
commands:
41+
- id: pip-install-requirements
42+
exec:
43+
commandLine: pip install -r requirements.txt
44+
workingDir: ${PROJECT_SOURCE}
45+
group:
46+
kind: build
47+
isDefault: true
48+
component: py
49+
- id: run-app
50+
exec:
51+
commandLine: 'python app.py'
52+
workingDir: ${PROJECT_SOURCE}
53+
component: py
54+
group:
55+
kind: run
56+
isDefault: true
57+
- id: debug-py
58+
exec:
59+
commandLine: 'pip install debugpy && python -m debugpy --listen 0.0.0.0:${DEBUG_PORT} app.py'
60+
workingDir: ${PROJECT_SOURCE}
61+
component: py
62+
group:
63+
kind: debug

stacks/python/3.0.0/devfile.yaml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
schemaVersion: 2.2.2
1+
schemaVersion: 2.2.0
22
metadata:
33
name: python
44
displayName: Python
@@ -28,9 +28,8 @@ components:
2828
args: ['tail', '-f', '/dev/null']
2929
mountSources: true
3030
endpoints:
31-
- name: https-python
31+
- name: http-python
3232
targetPort: 8080
33-
protocol: https
3433
- exposure: none
3534
name: debug
3635
targetPort: 5858
@@ -48,9 +47,8 @@ components:
4847
kubernetes:
4948
uri: kubernetes/deploy.yaml
5049
endpoints:
51-
- name: https-8081
50+
- name: http-8081
5251
targetPort: 8081
53-
protocol: https
5452
commands:
5553
- id: pip-install-requirements
5654
exec:

stacks/python/3.1.0/devfile.yaml

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
schemaVersion: 2.2.2
2+
metadata:
3+
name: python
4+
displayName: Python
5+
description: "Python (version 3.9.x) is an interpreted, object-oriented, high-level programming language with dynamic semantics.
6+
Its high-level built in data structures, combined with dynamic typing and dynamic binding, make it very attractive for Rapid Application Development, as well as for use as a scripting or glue language to connect existing components together."
7+
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/python.svg
8+
tags:
9+
- Python
10+
- Pip
11+
- Flask
12+
projectType: Python
13+
language: Python
14+
provider: Red Hat
15+
version: 3.1.0
16+
starterProjects:
17+
- name: flask-example
18+
description:
19+
'Flask is a web framework, it’s a Python module that lets you develop web applications easily.
20+
It’s has a small and easy-to-extend core: it’s a microframework that doesn’t include an ORM (Object Relational Manager) or such features.'
21+
git:
22+
remotes:
23+
origin: https://github.com/devfile-samples/python-ex
24+
components:
25+
- name: py
26+
container:
27+
image: registry.access.redhat.com/ubi9/python-39:1-172
28+
args: ['tail', '-f', '/dev/null']
29+
mountSources: true
30+
endpoints:
31+
- name: https-python
32+
targetPort: 8080
33+
protocol: https
34+
- exposure: none
35+
name: debug
36+
targetPort: 5858
37+
env:
38+
- name: DEBUG_PORT
39+
value: '5858'
40+
- name: build
41+
image:
42+
imageName: python-image:latest
43+
dockerfile:
44+
uri: docker/Dockerfile
45+
buildContext: .
46+
rootRequired: false
47+
- name: deploy
48+
kubernetes:
49+
uri: kubernetes/deploy.yaml
50+
endpoints:
51+
- name: https-8081
52+
targetPort: 8081
53+
protocol: https
54+
commands:
55+
- id: pip-install-requirements
56+
exec:
57+
commandLine: pip install -r requirements.txt
58+
workingDir: ${PROJECT_SOURCE}
59+
group:
60+
kind: build
61+
isDefault: true
62+
component: py
63+
- id: run-app
64+
exec:
65+
commandLine: 'python app.py'
66+
workingDir: ${PROJECT_SOURCE}
67+
component: py
68+
group:
69+
kind: run
70+
isDefault: true
71+
- id: debug-py
72+
exec:
73+
commandLine: 'pip install debugpy && python -m debugpy --listen 0.0.0.0:${DEBUG_PORT} app.py'
74+
workingDir: ${PROJECT_SOURCE}
75+
component: py
76+
group:
77+
kind: debug
78+
- id: build-image
79+
apply:
80+
component: build
81+
- id: deployk8s
82+
apply:
83+
component: deploy
84+
- id: deploy
85+
composite:
86+
commands:
87+
- build-image
88+
- deployk8s
89+
group:
90+
kind: deploy
91+
isDefault: true

stacks/python/3.1.0/docker/Dockerfile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
FROM registry.access.redhat.com/ubi9/python-39:latest
2+
3+
# By default, listen on port 8081
4+
EXPOSE 8081/tcp
5+
ENV FLASK_PORT=8081
6+
7+
# Set the working directory in the container
8+
WORKDIR /projects
9+
10+
# Copy the dependencies file to the working directory
11+
COPY requirements.txt .
12+
13+
# Install any dependencies
14+
RUN pip install -r requirements.txt
15+
16+
# Copy the content of the local src directory to the working directory
17+
COPY . .
18+
19+
# Specify the command to run on container start
20+
CMD [ "python", "./app.py" ]
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
kind: Service
2+
apiVersion: v1
3+
metadata:
4+
name: my-python
5+
spec:
6+
ports:
7+
- name: http-8081
8+
port: 8081
9+
protocol: TCP
10+
targetPort: 8081
11+
selector:
12+
app: python-app
13+
---
14+
kind: Deployment
15+
apiVersion: apps/v1
16+
metadata:
17+
name: my-python
18+
spec:
19+
replicas: 1
20+
selector:
21+
matchLabels:
22+
app: python-app
23+
template:
24+
metadata:
25+
labels:
26+
app: python-app
27+
spec:
28+
containers:
29+
- name: my-python
30+
image: python-image:latest
31+
ports:
32+
- name: http
33+
containerPort: 8081
34+
protocol: TCP
35+
resources:
36+
requests:
37+
memory: "50Mi"
38+
cpu: "10m"
39+
limits:
40+
memory: "100Mi"
41+
cpu: "100m"

stacks/python/stack.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ displayName: Python
55
icon: https://raw.githubusercontent.com/devfile-samples/devfile-stack-icons/main/python.svg
66
versions:
77
- version: 2.1.0
8+
- version: 2.2.0
89
default: true # should have one and only one default version
910
- version: 3.0.0
11+
- version: 3.1.0

0 commit comments

Comments
 (0)