Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

194 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

mockbook

License: MIT Docker Image Version

Docker image for writing and serving mocks with Jupyter and FastAPI.

Demo

✨ Features

Mockbook is a simple FastAPI application with the following features:

  • Write mock endpoints with a Jupyter Notebook to manage mock endpoints
  • Serve mock endpoints with a FastAPI server and live reloading.
  • Preconfigured NGINX reverse proxy with a reloader triggered by configuration file changes for flexible mocking.
  • Preinstalled libraries for writing mocks, such as: factory-boy, Faker

🚀 How to use

To pull and run the image from Docker Hub, run:

$ docker run --rm \
    -p 127.0.0.1:80:80 \
    -e JUPYTERLAB_ARGS='--NotebookApp.token=token' \
    lasuillard/mockbook:main

The following endpoints are available (via NGINX):

graph LR
  browser[Browser]
  mockbook[Mockbook]
  jupyterlab[JupyterLab]
  nginx[NGINX]

  browser -->|http://localhost:80| nginx
  nginx -->|/| mockbook
  nginx -->|/jupyter| jupyterlab
Loading

⚙️ Environment variables

Key Description
MOCKBOOK_ARGS Extra arguments for Mockbook's uvicorn server (uvicorn).
MOCKBOOK_AUTORELOAD_DISABLED Disable auto reloading (--reload).
May be useful for certain environments (such as testing) where reloading is not desirable.
JUPYTERLAB_ARGS Extra arguments for JupyterLab (jupyter lab).
JUPYTERLAB_DISABLED Disable the JupyterLab service.
May be useful for certain environments (such as testing) where the notebook is unnecessary.
NGINX_ARGS Extra arguments to pass to NGINX (nginx).
NGINX_DISABLED Disable the NGINX service.
NGINX_RELOADER_DISABLED Disable the NGINX reloader.

📂 Mount points

  • /app/mockbook/notebooks for Jupyter notebooks. The Mockbook app watches /app/mockbook/ for changes and reloads FastAPI automatically.
  • /app/mockbook/nginx for NGINX configuration. The auto reloader watches this directory and reloads NGINX automatically.

Please check the examples directory for more usage examples.

💖 Contributing

Please refer to CONTRIBUTING.md for more information on how to contribute to this project.

📜 License

This project is licensed under the MIT License.

About

Docker image for writing and serving mocks with Jupyter and FastAPI.

Topics

Resources

Contributing

Stars

0 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages