Giter Club home page Giter Club logo

demotest's Introduction

FastAPI/Python Service Template

This is a template for building modular web services with a best-practise organization of files using the FastAPI web framework.

Run in Docker

Development target

The development target will allow for automatic reloading when source code changes. This requires that the local directory is bind-mounted using the -v or --volume argument. To Build and run the development target from the command line:

docker build --rm -q -f Dockerfile \
  --label "sintef.fastservice-target=development" \
  --target development \
  -t "sintef/fastservice-development:latest" .
  
docker run --rm -i --user="$(id -u):$(id -g)" -p 8080:8080 -v "$PWD:/app" sintef/fastservice-development:latest

Open http://localhost:8080 on your browser to test the application.

Production target

The production target will not reload itself on code change and will run a predictable version of the code on port 80. Also you might want to use a named container with the --restart=always option to ensure that the container is restarted indefinately regardless of the exit status. To build and run the production target from the command line:

docker build --rm -q -f Dockerfile \
  --label "sintef.fastservice-target=production" \
  --target production \
  -t "sintef/fastservice-production:latest" .
  
docker run -d -p 80:80 --user="$(id -u):$(id -g)" --name fastservice --restart=always sintef/fastservice-production:latest

demotest's People

Contributors

quaat 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.