Skip to content

Eyevinn/python-runner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python Runner

Docker container that clones a GitHub repository containing a Python web application, installs dependencies, and runs the application.

Usage

From GitHub

docker run --rm \
  -e GITHUB_URL=https://github.com/<org>/<repo>/ \
  -e GITHUB_TOKEN=<token> \
  -p 8080:8080 \
  eyevinn/python-runner

From S3 / MinIO

First, zip your project directory:

cd my-python-app && zip -r ../my-app.zip .

Upload the zip file to your S3 bucket, then run:

docker run --rm \
  -e SOURCE_URL=s3://bucket/my-app.zip \
  -e S3_ENDPOINT_URL=http://minio:9000 \
  -e AWS_ACCESS_KEY_ID=<access-key> \
  -e AWS_SECRET_ACCESS_KEY=<secret-key> \
  -p 8080:8080 \
  eyevinn/python-runner

Environment Variables

Variable Description
GITHUB_URL GitHub repository URL (e.g., https://github.com/org/repo/)
GITHUB_TOKEN GitHub personal access token for private repositories
SOURCE_URL S3 URL to a zipped application (e.g., s3://bucket/app.zip)
S3_ENDPOINT_URL Custom S3 endpoint URL (for MinIO or other S3-compatible services)
AWS_ACCESS_KEY_ID AWS/S3 access key ID
AWS_SECRET_ACCESS_KEY AWS/S3 secret access key
OSC_ACCESS_TOKEN Access token for Eyevinn Open Source Cloud config service
CONFIG_SVC URL to config service endpoint
PORT Port to run the application on (default: 8080)

Supported Project Structures

The runner automatically detects and installs dependencies from:

  • pyproject.toml - Modern Python packaging (PEP 517/518)
  • requirements.txt - Traditional pip requirements file
  • setup.py - Legacy setuptools configuration

If a setup.sh script is present in the repository root, it will be executed after dependency installation.

Automatic Framework Detection

The runner automatically detects your application type and starts it with the appropriate server:

Framework Detection Server Used
FastAPI/Starlette fastapi or starlette in dependencies uvicorn
Flask flask in dependencies gunicorn (if available) or flask run
Gunicorn gunicorn in dependencies + config file gunicorn with config
Plain Python main.py or app.py present python main.py

The runner looks for the app object in common entry point files (main.py, app.py, application.py, server.py, api.py) and detects common patterns like app = FastAPI() or app = Flask(__name__).

Custom Command

You can override the auto-detection by passing a custom command:

docker run --rm \
  -e GITHUB_URL=https://github.com/<org>/<repo>/ \
  -p 8080:8080 \
  eyevinn/python-runner \
  python app.py

Or for a specific Flask configuration:

docker run --rm \
  -e GITHUB_URL=https://github.com/<org>/<repo>/ \
  -p 8080:8080 \
  eyevinn/python-runner \
  flask run --host=0.0.0.0 --port=8080

Or for Gunicorn with specific options:

docker run --rm \
  -e GITHUB_URL=https://github.com/<org>/<repo>/ \
  -p 8080:8080 \
  eyevinn/python-runner \
  gunicorn -w 4 -b 0.0.0.0:8080 main:app

Building

docker build -t eyevinn/python-runner .

License

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

About Eyevinn Technology

Eyevinn Technology is an independent consultant firm specialized in video and streaming. We assist companies with their streaming and cloud strategies, including architecture design and implementation.

In addition to consulting services, we offer cloud-based products like the Eyevinn Open Source Cloud platform - a fully managed solution to launch open-source products in AWS infrastructure.

Contact

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published