Dixing Xu
commited on
:whale: Add Dockerfile
Browse files- .dockerignore +17 -0
- Dockerfile +55 -0
- README.md +30 -0
.dockerignore
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.git
|
2 |
+
.gitignore
|
3 |
+
logs/
|
4 |
+
workspaces/
|
5 |
+
__pycache__/
|
6 |
+
*.pyc
|
7 |
+
*.pyo
|
8 |
+
*.pyd
|
9 |
+
.Python
|
10 |
+
*.so
|
11 |
+
*.egg
|
12 |
+
*.egg-info/
|
13 |
+
.env
|
14 |
+
.venv
|
15 |
+
.coverage
|
16 |
+
.pytest_cache/
|
17 |
+
.mypy_cache/
|
Dockerfile
ADDED
@@ -0,0 +1,55 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# syntax=docker/dockerfile:1
|
2 |
+
|
3 |
+
# Build stage
|
4 |
+
FROM python:3.10-slim AS builder
|
5 |
+
|
6 |
+
# Install build dependencies
|
7 |
+
RUN apt-get update && \
|
8 |
+
apt-get install -y --no-install-recommends \
|
9 |
+
build-essential \
|
10 |
+
gcc \
|
11 |
+
&& rm -rf /var/lib/apt/lists/*
|
12 |
+
|
13 |
+
# Set working directory
|
14 |
+
WORKDIR /app
|
15 |
+
|
16 |
+
# Copy only the files needed for installation
|
17 |
+
COPY requirements.txt setup.py README.md ./
|
18 |
+
COPY aide ./aide
|
19 |
+
|
20 |
+
# Create virtual environment and install dependencies
|
21 |
+
RUN python -m venv /opt/venv && \
|
22 |
+
. /opt/venv/bin/activate && \
|
23 |
+
pip install --no-cache-dir -r requirements.txt && \
|
24 |
+
pip install -e .
|
25 |
+
|
26 |
+
# Runtime stage
|
27 |
+
FROM python:3.10-slim
|
28 |
+
|
29 |
+
# Install runtime dependencies
|
30 |
+
RUN apt-get update && \
|
31 |
+
apt-get install -y --no-install-recommends \
|
32 |
+
unzip \
|
33 |
+
&& rm -rf /var/lib/apt/lists/*
|
34 |
+
|
35 |
+
# Create non-root user
|
36 |
+
RUN useradd -m -u 1000 aide
|
37 |
+
|
38 |
+
# Copy virtual environment from builder
|
39 |
+
COPY --from=builder /opt/venv /opt/venv
|
40 |
+
# Copy the package files needed for the installation
|
41 |
+
COPY --from=builder /app /app
|
42 |
+
ENV PATH="/opt/venv/bin:$PATH"
|
43 |
+
|
44 |
+
# Set working directory
|
45 |
+
WORKDIR /app
|
46 |
+
|
47 |
+
# Create and set permissions for logs and workspaces
|
48 |
+
RUN mkdir -p logs workspaces && \
|
49 |
+
chown -R aide:aide /app
|
50 |
+
|
51 |
+
# Switch to non-root user
|
52 |
+
USER aide
|
53 |
+
|
54 |
+
# Set default command
|
55 |
+
ENTRYPOINT ["aide"]
|
README.md
CHANGED
@@ -133,6 +133,36 @@ cd aideml
|
|
133 |
pip install -e .
|
134 |
```
|
135 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
136 |
Contribution guide will be available soon.
|
137 |
|
138 |
## Algorithm Description
|
|
|
133 |
pip install -e .
|
134 |
```
|
135 |
|
136 |
+
## Using AIDE with Docker
|
137 |
+
|
138 |
+
You can also run AIDE using Docker:
|
139 |
+
|
140 |
+
1. Build the Docker image:
|
141 |
+
```bash
|
142 |
+
docker build -t aide .
|
143 |
+
```
|
144 |
+
|
145 |
+
2. Run AIDE with Docker (example with house prices task):
|
146 |
+
```bash
|
147 |
+
# Set custom workspace and logs location (optional)
|
148 |
+
export WORKSPACE_BASE=$(pwd)/workspaces
|
149 |
+
export LOGS_DIR=$(pwd)/logs
|
150 |
+
|
151 |
+
docker run -it --rm \
|
152 |
+
-v "${LOGS_DIR:-$(pwd)/logs}:/app/logs" \
|
153 |
+
-v "${WORKSPACE_BASE:-$(pwd)/workspaces}:/app/workspaces" \
|
154 |
+
-v "$(pwd)/aide/example_tasks:/app/data" \
|
155 |
+
-e OPENAI_API_KEY="your-actual-api-key" \
|
156 |
+
aide \
|
157 |
+
data_dir=/app/data/house_prices \
|
158 |
+
goal="Predict the sales price for each house" \
|
159 |
+
eval="Use the RMSE metric between the logarithm of the predicted and observed values."
|
160 |
+
```
|
161 |
+
|
162 |
+
You can customize the location of workspaces and logs by setting environment variables before running the container:
|
163 |
+
- `WORKSPACE_BASE`: Sets the base directory for AIDE workspaces (default: `$(pwd)/workspaces`)
|
164 |
+
- `LOGS_DIR`: Sets the directory for AIDE logs (default: `$(pwd)/logs`)
|
165 |
+
|
166 |
Contribution guide will be available soon.
|
167 |
|
168 |
## Algorithm Description
|