A containerized Machine Learning API and web interface for predicting logistics transit times.
979
LogiPredict is a full-stack, production-grade web application and RESTful API that predicts shipment transit times using a trained Random Forest Regressor machine learning pipeline.
This repository hosts the stateless web/API compute layer, optimized using a multi-stage Debian-slim build, running an unprivileged system user, and utilizing Gunicorn with master process preloading for high-concurrency safety.
This image contains the application runtime and the pre-trained machine learning model (model.pkl). It is entirely stateless and requires a backing PostgreSQL database to log estimation audits and maintain persistent history.
Do not run this image in absolute isolation without providing a valid DATABASE_URL.
The container reads configuration parameters via environment runtime injection. Ensure the following variables are passed to the container:
| Variable | Description | Example / Default |
|---|---|---|
SECRET_KEY | Symmetric encryption key for securing Flask session states. | your_secure_string |
DATABASE_URL | Fully qualified connection URI pointing to a target PostgreSQL service. | postgresql://user:pass@hostname:5432/dbname |
FLASK_ENV | Sets the application execution mode. | production |
The recommended deployment workflow is to orchestrate this image alongside a native PostgreSQL container using Docker Compose. This architecture handles network isolation, database health checks, and data volume mapping automatically.
Create a docker-compose.yml file in your workspace:
services:
web:
image: shakeelsaga/logipredict:v1.0.0
ports:
- "8080:5000"
environment:
- SECRET_KEY=super_secure_flask_key
- DATABASE_URL=postgresql://logi_user:logi_pass@db:5432/logipredict_db
depends_on:
db:
condition: service_healthy
db:
image: postgres:15-alpine
environment:
- POSTGRES_USER=logi_user
- POSTGRES_PASSWORD=logi_pass
- POSTGRES_DB=logipredict_db
volumes:
- pg_data:/var/lib/postgresql/data
expose:
- "5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U logi_user -d logipredict_db"]
interval: 5s
timeout: 5s
retries: 5
volumes:
pg_data:
Launch the decoupled environment directly from your shell:
docker compose up -d
The application interface will be accessible on the host machine at http://localhost:8080.
gcc, build-essential) and caching modules, dropping artifact overhead significantly.logiuser).SIGTERM).--preload) to safeguard system catalogs during multi-worker initialization steps.Content type
Image
Digest
sha256:4a532fb85…
Size
169.9 MB
Last updated
29 days ago
docker pull shakeelsaga/logipredict