File tree Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Expand file tree Collapse file tree 3 files changed +71
-0
lines changed Original file line number Diff line number Diff line change 1+ # Use an official Python image as the base
2+ FROM python:3.12-slim
3+
4+ # Set the working directory inside the container
5+ WORKDIR /app
6+
7+ # Install system dependencies
8+ RUN apt-get update && apt-get install -y --no-install-recommends \
9+ build-essential \
10+ && rm -rf /var/lib/apt/lists/*
11+
12+ # Copy the project files into the container
13+ COPY . /app
14+
15+ # Install Python dependencies
16+ RUN pip install --root-user-action=ignore -e .
17+
18+ # Expose the project directory as a volume
19+ VOLUME ["/app" ]
20+
21+ # Set the entry point to the openevolve-run.py script
22+ ENTRYPOINT ["python" , "/app/openevolve-run.py" ]
Original file line number Diff line number Diff line change 1+ # Variables
2+ PROJECT_DIR := $(shell pwd)
3+ DOCKER_IMAGE := openevolve
4+ VENV_DIR := $(PROJECT_DIR ) /env
5+ PYTHON := $(VENV_DIR ) /bin/python
6+ PIP := $(VENV_DIR ) /bin/pip
7+
8+ # Default target
9+ .PHONY : all
10+ all : install test
11+
12+ # Create and activate the virtual environment
13+ .PHONY : venv
14+ venv :
15+ python3 -m venv $(VENV_DIR )
16+
17+ # Install Python dependencies in the virtual environment
18+ .PHONY : install
19+ install : venv
20+ $(PIP ) install -e .
21+
22+ # Run Black code formatting
23+ .PHONY : lint
24+ lint : venv
25+ $(PYTHON ) -m black openevolve examples tests
26+
27+ # Run tests using the virtual environment
28+ .PHONY : test
29+ test : venv
30+ $(PYTHON ) -m unittest discover -s tests -p " test_*.py"
31+
32+ # Build the Docker image
33+ .PHONY : docker-build
34+ docker-build :
35+ docker build -t $(DOCKER_IMAGE ) .
36+
37+ # Run the Docker container with the example
38+ .PHONY : docker-run
39+ docker-run :
40+ docker run --rm -v $(PROJECT_DIR ) :/app $(DOCKER_IMAGE ) examples/function_minimization/initial_program.py examples/function_minimization/evaluator.py --config examples/function_minimization/config.yaml --iterations 1000
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ OpenEvolve follows an evolutionary approach with the following components:
2727
2828### Installation
2929
30+ To install natively, use:
3031``` bash
3132git clone https://github.com/codelion/openevolve.git
3233cd openevolve
@@ -60,6 +61,14 @@ OpenEvolve can also be run from the command line:
6061python openevolve-run.py path/to/initial_program.py path/to/evaluator.py --config path/to/config.yaml --iterations 1000
6162```
6263
64+ ### Docker
65+
66+ You can also install and execute via Docker:
67+ ``` bash
68+ docker build -t openevolve .
69+ docker run --rm -v .:/app openevolve examples/function_minimization/initial_program.py examples/function_minimization/evaluator.py --config examples/function_minimization/config.yaml --iterations 1000
70+ ```
71+
6372## Configuration
6473
6574OpenEvolve is highly configurable. You can specify configuration options in a YAML file:
You can’t perform that action at this time.
0 commit comments