This is a simple flask application
This app is designed to run in different ways:
- As a standalone app running on your machine
- As a Docker container running locally
- As a Docker image published in Docker Hub
- As an application hosted by IBM Cloud
- install python
git clonethe project thencdinto the directory- run
virtualenv -p /usr/bin/python3 venvorpython -m venv venvto create a virtual environment - activate it using
source venv/bin/activate pip install -r requirements.txtto install the app libraries and it dependencies
After installing, run the server using python app.py
Access the running app in a browser at the URL written to the console (most likely http://localhost:5000)
- install Docker
run docker --versionto check if docker is installed- run
docker build -t flask-hello-world:latest .to build the docker image docker imageslist the local available images- run
docker run --name flask_hello_world -d -p 8000:5000 --rm flask-hello-world:latestto start the container - Navigate to http://localhost:8000 in a browser to see the results. If you want to share it with your local network devices navigate to http://[your-ip-address]:8000
Docker Hub is a free service to publicly store available images.
- you need to install only Docker
- just run
docker run -d -p 8080:5000 --name flask ahmnouira/flask-hello-world
Before you begin, verify that you have completed the below steps:
- you have access to an IBM Cloud account.
- the IBM Cloud CLI is installed in your workstation.
- clone the repository by running
git clone https://github.com/AhmNouira/flask-hello-world cd flask-hello-world- run
bx loginto login to your IBM cloud account and enter your email and password bx target --cfto target the Cloud Foundry To check the default organization and space to which you have access, go to https://cloud.ibm.com/account/cloud-foundry.bx cf pushto push the application to IBM Cloud- if you found any error run
bx cf logs flask-hello-world --recentto see the troubleshoot - check whether your app is running
bx cf app flask-hello-world - to explore how your app directories are structured
bx cf ssh flask-hello-world
Login to the docker.io using the access token
docker login -u ahmnouira docker.io Build and tag
docker build -t flask-hello-world:latest .Tag it as per the docker hub repository name
docker tag flask-hello-world:latest ahmnouira/flask-hello-world:latestPush the a new image:
docker image push ahmnouira/flask-hello-world:latest 

