34
loading...
This website collects cookies to deliver better user experience
main.py
file and enter the following:from flask import Flask
app = Flask(__name__)
@app.route("/")
def hello():
return "Hello World from Pycon Flask"
if __name__ == "__main__":
# Only for debugging while developing
app.run(host='0.0.0.0', debug=True, port=80)
Dockerfile
in the root directory of the project and enter the following:FROM tiangolo/uwsgi-nginx-flask:python3.7
COPY ./py-app /py-app
$ docker build -t hello-world .
$ docker run -d --name pycon -p 80:80 hello-world
curl http://localhost
ibmcloud login -a https://cloud.ibm.com
ibmcloud login --sso
us-south
ibmcloud cr region-set us-south
ibmcloud cr namespace-add $(kubectl config view --minify --output 'jsonpath={..namespace}')
kubectl config view --minify --output 'jsonpath={..namespace}'
ibmcloud cr login
docker tag hello-world us.icr.io/<namespace>/hello-world:latest
docker push us.icr.io/<namespace>/hello-world:latest
kubectl create deployment hello-world-deployment --image=us.icr.io/<namespace>/hello-world:latest
deployment "hello-world-deployment" created
kubectl expose deployment/hello-world-deployment --type=NodePort --port=80 --name=hello-world-service --target-port=80
kubectl describe service hello-world-service
ibmcloud ks worker ls --cluster <cluster_name>
http://<IP_address>:<NodePort>
Hello World from Pycon Flask
@mrinasugosh
) ====