metadata-processor
This repository contains a Flask implementation of a REST API to process image metadata.
Development
- Clone the repository.
- Open the folder with VS Code.
- Click on the bottom left corner and choose "Open Folder in Container".
- Press Ctrl+` to open a terminal.
- You have two options to test the API
- Running a server:
- Run
make flask
to the Flask development server ormake gunicorn
to run the gunicorn server. - Open another terminal and run:
make api_test
or./tests/api_test.sh
to send a JSON object to the API server.
- Run
- Running Python tests:
- Run
make pytest
to run pytest tests
- Run
- Running a server:
Make commands
- Build the Docker image:
make DOCKER_USER=bsamadi docker-build
- Push the Docker image to hub.docker.com:
make DOCKER_USER=bsamadi docker-push
- Pull the Docker image from hub.docker.com:
make DOCKER_USER=bsamadi docker-pull
- Run the API in a Docker container:
make start
- Stop the Docker container:
make stop
- Install the Python requirements:
make requirements
- Run the Flask development server:
make flask
- Run the Gunicorn server:
make gunicorn
- Lint the code with Flake8:
make flake8
- Autoformat files with Black:
make black
- Run unittest tests:
make unittest
- Run pytest tests:
make pytest
Features
- VS Code Devcontainer
- Makefile
- Binder compatible
-
requirements.txt
-
apt.txt
-
- Production Docker image
-
docker-compose
-
- Tests
- API
- Pytest
- Unittest
- Linting
- Flake8
- Black
- Folder structure
- Deploy to Heroku
- Deploy to a (cloud or local) Kubernetes cluster with HTTPS
- Deploy to a (cloud or local) Nomad cluster with HTTPS