diff --git a/.circleci/config.yml b/.circleci/config.yml index 07e685b8f..918e647af 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -328,6 +328,30 @@ jobs: - store_test_results: path: test-results + build_docker_image: + docker: + - image: circleci/python:3.12 + steps: + - checkout + - setup_remote_docker: + version: 20.10.7 + - run: + name: Build Docker image + command: | + docker build -t exo:latest . + - run: + name: Tag Docker image + command: | + docker tag exo:latest your-dockerhub-username/exo:latest + - run: + name: Login to DockerHub + command: | + echo "$DOCKERHUB_PASSWORD" | docker login -u "$DOCKERHUB_USERNAME" --password-stdin + - run: + name: Push Docker image + command: | + docker push your-dockerhub-username/exo:latest + workflows: version: 2 build_and_test: @@ -344,3 +368,4 @@ workflows: - chatgpt_api_integration_test_tinygrad - chatgpt_api_integration_test_dummy - measure_pip_sizes + - build_docker_image diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..530d5c4ee --- /dev/null +++ b/Dockerfile @@ -0,0 +1,15 @@ +# Use a base image with Python 3.12 +FROM python:3.12-slim + +# Set the working directory +WORKDIR /app + +# Copy the project files into the Docker image +COPY . . + +# Install the project dependencies +RUN pip install --upgrade pip +RUN pip install -e . + +# Set the entry point to run the project +ENTRYPOINT ["exo"] diff --git a/README.md b/README.md index 9881097a4..11b45549a 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,31 @@ pip install -e . source install.sh ``` +### Using Docker + +You can also build and run exo using Docker. + +#### Build the Docker image + +```sh +docker build -t exo:latest . +``` + +#### Run the Docker container + +```sh +docker run -p 52415:52415 exo:latest +``` + +### Using Docker Compose + +You can use Docker Compose to run exo with multiple services. + +#### Build and run the services + +```sh +docker-compose up --build +``` ### Troubleshooting diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..a35efe74c --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,12 @@ +version: '3.8' + +services: + exo: + build: + context: . + dockerfile: Dockerfile + ports: + - "52415:52415" + environment: + - DEBUG=1 + - TINYGRAD_DEBUG=2