Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/krook/code-engine-flask-app
Sample app to try to deploy a Python Flask app as a Code Engine app
https://github.com/krook/code-engine-flask-app
Last synced: about 1 month ago
JSON representation
Sample app to try to deploy a Python Flask app as a Code Engine app
- Host: GitHub
- URL: https://github.com/krook/code-engine-flask-app
- Owner: krook
- License: apache-2.0
- Created: 2021-05-27T19:19:04.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2021-05-27T20:32:47.000Z (over 3 years ago)
- Last Synced: 2024-10-12T19:12:13.162Z (2 months ago)
- Language: Python
- Homepage:
- Size: 10.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Code Engine Flask App
## Set up your environment
See the [Scalable APIs](https://github.com/Call-for-Code/Code-Engine-Scalable-APIs) example.
```bash
# Log in with your standard account, can't be a Lite account
ibmcloud login
export DOCKERHUB_USERNAME=[YOUR DOCKERHUB USERNAME]
export DOCKERHUB_PASSWORD=[YOUR DOCKERHUB PASSWORD]# Create a resource group for your projects, or reuse an existing one
ibmcloud resource group-create call-for-code
ibmcloud target -g call-for-code# Create a project for your applications, and a registry entry for the place to store images
ibmcloud ce project create --name flask-app
ibmcloud ce registry create \
--name dockerhub \
--server https://index.docker.io/v1/ \
--username $DOCKERHUB_USERNAME \
--password $DOCKERHUB_PASSWORD
ibmcloud ce project select --name flask-app
```## Build and deploy
```bash
# Change to the post-cat directory
cd flask# Build the image. Make sure the Docker daemon is running.
docker build --no-cache -t $DOCKERHUB_USERNAME/flask-app .# And push it
docker push $DOCKERHUB_USERNAME/flask-app# Create the app
ibmcloud ce application create --name flask-app --image $DOCKERHUB_USERNAME/flask-app# Get app details, if needed
ibmcloud ce application get --name flask-app# Get the URL of the app for later use
URL=$(ibmcloud ce application get --name flask-app --output url)
```## Test
```bash
curl $URL
```