Skip to content

Commit cb2e6cc

Browse files
committed
Finalize devfile version
Signed-off-by: thepetk <[email protected]>
1 parent 728c783 commit cb2e6cc

File tree

5 files changed

+12
-34
lines changed

5 files changed

+12
-34
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Creating an application with a Python code sample
22

3-
**Note:** The Python code sample version `2.0.0` uses the **8080** HTTP port.
3+
**Note:** The Python code sample version `2.0.0` uses the **8081** HTTP port.
44

55
Before you begin creating an application with this `devfile` code sample, it's helpful to understand the relationship between the `devfile` and `Dockerfile` and how they contribute to your build. You can find these files at the following URLs:
66

app.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ def hello():
88
return "Hello World!"
99

1010
if __name__ == '__main__':
11-
port = os.environ.get('FLASK_PORT') or 8080
11+
port = os.environ.get('FLASK_PORT') or 8081
1212
port = int(port)
1313

1414
app.run(port=port,host='0.0.0.0')

devfile.yaml

+3-25
Original file line numberDiff line numberDiff line change
@@ -21,39 +21,17 @@ parent:
2121
id: python
2222
registryUrl: 'https://registry.devfile.io'
2323
version: 3.0.0
24-
commands:
25-
- id: build-image
26-
apply:
27-
component: build
28-
- id: deployk8s
29-
apply:
30-
component: deploy
31-
- id: deploy
32-
composite:
33-
commands:
34-
- build-image
35-
- deployk8s
36-
group:
37-
kind: deploy
38-
isDefault: true
3924
components:
40-
- name: build
41-
image:
42-
imageName: python-image:latest
43-
dockerfile:
44-
uri: docker/Dockerfile
45-
buildContext: .
46-
rootRequired: false
4725
- name: deploy
4826
attributes:
4927
deployment/replicas: 1
5028
deployment/cpuRequest: 10m
5129
deployment/memoryRequest: 50Mi
52-
deployment/container-port: 8080
30+
deployment/container-port: 8081
5331
kubernetes:
5432
uri: kubernetes/deploy.yaml
5533
endpoints:
56-
- name: http-8080
57-
targetPort: 8080
34+
- name: http-8081
35+
targetPort: 8081
5836
path: /
5937

docker/Dockerfile

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
FROM registry.access.redhat.com/ubi9/python-39:1-117.1684741281
22

3-
# By default, listen on port 8080
4-
EXPOSE 8080/tcp
5-
ENV FLASK_PORT=8080
3+
# By default, listen on port 8081
4+
EXPOSE 8081/tcp
5+
ENV FLASK_PORT=8081
66

77
# Set the working directory in the container
88
WORKDIR /projects

kubernetes/deploy.yaml

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ spec:
1717
image: python-image:latest
1818
ports:
1919
- name: http
20-
containerPort: 8080
20+
containerPort: 8081
2121
protocol: TCP
2222
resources:
2323
requests:
@@ -30,9 +30,9 @@ metadata:
3030
name: my-python
3131
spec:
3232
ports:
33-
- name: http-8080
34-
port: 8080
33+
- name: http-8081
34+
port: 8081
3535
protocol: TCP
36-
targetPort: 8080
36+
targetPort: 8081
3737
selector:
3838
app: python-app

0 commit comments

Comments
 (0)