Giter Site home page Giter Site logo

prime's Introduction

Prime

A simple Python Flask app that checks if a given number is prime, and if not, finds the closest prime number.

You could just run this locally using "flask run", or follow one of the options below to either deploy directly to the Azure cloud, or create it as a container image to deploy anywhere.

Option 1: Deploy as an Azure Container App

The Azure Container Apps service supports directly deploying a web app using the "az containerapp up" CLI command.

This command automatically converts a web app app to a container image and deploys it. Here's an example using the Azure Cloud Shell (which comes with the Azure CLI pre-installed):

  1. Connect to Azure Cloud shell (https://shell.azure.com)
  2. Clone this repo:
    git clone https://github.com/gbowerman/prime
  3. cd prime
  4. az containerapp up --name prime --source . --ingress external --target-port 5000 --resource-group prime-group

Note: The first time you run "az containerapp up" you'll be prompted to install an Azure CLI extension.

Option 2: Create and run a Docker container image

Note: If running on Windows, first install Docker Desktop, and make sure you have git installed.

Change the image tag "prime-app" in the commands below to any name you want to give it.

  1. Clone this repo locally (e.g. using git command line or VS Code etc.)

  2. cd to the prime directory

  3. Build a container image:
    docker buildx build . -t prime-app:latest

  4. Test locally:
    docker run -d --name prime-app-container -p 80:5000 prime-app:latest

  5. Connect to the running app at localhost:80

Acknowledgements
Credit to Rahul Upadhyaya (@kavishavi) for the inspiration. (see PrimeContainerapp for the latest version of his project)

License
This project is licensed under the MIT License - see the LICENSE file for details.

prime's People

Contributors

gbowerman avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.