Skip to content

Commit 6c791c8

Browse files
authored
feat: Add Docker and Docker Compose Support (#140)
## Description Added Docker support for the project * added `Dockerfile` for building environment * `docker-compose.yaml`for volume mounting * added `README` for instructing on building and testing ## Checklist Go over all the following points, and put an `x` in all the boxes that apply. - [x] I have read the [CONTRIBUTION](https://github.com/camel-ai/oasis/blob/master/CONTRIBUTING.md) guide (**required**) - [x] I have linked this PR to an issue using the Development section on the right sidebar or by adding `Fixes #issue-number` in the PR description (**required**) - [x] I have checked if any dependencies need to be added or updated in `pyproject.toml` - [x] I have updated the tests accordingly (*required for a bug fix or a new feature*) - [x] I have updated the documentation if needed: - [ ] I have added examples if this is a new feature Fixed #127
2 parents d93ce4f + 7560cfd commit 6c791c8

File tree

4 files changed

+137
-0
lines changed

4 files changed

+137
-0
lines changed

.container/.env.example

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Necessary Keys
2+
OPENAI_API_KEY=sk-123456789
3+
4+
# Optional Keys
5+
# For Jina URL Reader
6+
JINA_API_KEY=jina_123456789
7+
8+
# For Cohere Rerank
9+
COHERE_API_KEY=abcdefghi
10+
11+
# For Google Search API
12+
# https://developers.google.com/custom-search/v1/overview
13+
GOOGLE_API_KEY=123456789
14+
# https://cse.google.com/cse/all
15+
SEARCH_ENGINE_ID=123456789
16+
17+
# For OpenWeatherMap API
18+
OPENWEATHERMAP_API_KEY=123456789

.container/Dockerfile

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FROM python:3.10-bookworm
2+
3+
# Install uv and common tools
4+
RUN apt-get update && apt-get install -y curl git && \
5+
pip install uv && \
6+
rm -rf /var/lib/apt/lists/*
7+
8+
# Set workdir
9+
WORKDIR /app/oasis
10+
11+
# Copy code
12+
COPY . .
13+
14+
# Set up venv + install dev deps
15+
RUN uv venv .venv --python=3.10 && \
16+
. .venv/bin/activate && \
17+
uv pip install -e ".[dev]" && \
18+
pip install pre-commit mypy && \
19+
pre-commit install
20+
21+
# Keep container alive for development
22+
CMD ["tail", "-f", "/dev/null"]

.container/README.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Install OASIS with Docker
2+
3+
Docker provides a consistent and isolated environment to build, run, and develop oasis without worrying about system dependencies. This guide walks you through setting up oasis using Docker, running it, and developing with it.
4+
5+
## Prerequisites
6+
- Docker:https://docs.docker.com/engine/install/
7+
- Docker Compose:https://docs.docker.com/compose/install/
8+
9+
## Configure Environment
10+
Before starting the container, you need to navigate into the
11+
[.container](../.container) folder and create a `.env` file **with your own
12+
API keys**, so that these keys will be present in the environment variables of
13+
the container, which will later be used by OASIS.
14+
15+
```bash
16+
cd .container
17+
18+
# Create your own .env file by copying the example
19+
cp .env.example .env
20+
21+
# Edit .env to add your API keys or custom settings
22+
```
23+
24+
## Start Container
25+
To build and start the development container:
26+
27+
```bash
28+
docker compose up -d
29+
```
30+
This will:
31+
* Build the image oasis:localdev
32+
* Start the container oasis-localdev
33+
* Set up all necessary dependencies
34+
35+
After the build is complete, you can verify the list of images and all running containers.
36+
37+
```bash
38+
# List all Docker images
39+
docker images
40+
# Check running containers
41+
docker ps
42+
```
43+
44+
## Enter the Container
45+
Once running, you can access the container like this:
46+
47+
```bash
48+
docker compose exec oasis bash
49+
```
50+
You’ll now be inside the oasis dev environment.
51+
52+
From here, you can activate your virtual environment (if used) and run tests:
53+
```bash
54+
# Any other dev/test command
55+
pytest
56+
pre-commit run --all-files
57+
```
58+
59+
## Save Your Progress
60+
Your local code is volume-mounted into the container. That means any changes you make inside the container are reflected in your local project folder — no need to worry about losing your work.
61+
62+
## Exit, Stop and Delete the Container
63+
You can simply press `Ctrl + D` or use the `exit` command to exit the
64+
container.
65+
66+
After exiting the container, under normal cases the container will still be
67+
running in the background. If you don't need the container anymore, you can
68+
stop and delete the container with the following command.
69+
70+
```bash
71+
docker compose down
72+
```
73+
74+
## Online Images
75+
For users who only want to have a quick tryout on OASIS, we also provide the
76+
pre-built images on
77+
[our GitHub Container Registry]().
78+
79+
## Pre-built Image (Optional)
80+
If you only want to try oasis without setting up the build:
81+
82+
```bash
83+
84+
```
85+

.container/docker-compose.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
services:
2+
oasis:
3+
image: oasis:localdev
4+
container_name: oasis-localdev
5+
build:
6+
context: ../
7+
dockerfile: .container/Dockerfile
8+
volumes:
9+
- ../:/app/oasis
10+
env_file:
11+
- .env
12+
command: ["tail", "-f", "/dev/null"]

0 commit comments

Comments
 (0)