mirror of https://github.com/microsoft/autogen.git
Cleanup and unify Dockerfiles (#1333)
* Create studio subfolder in devcontainer * Update to follow readme instructions * Move dockerfiles from samples to .devcontainer * Fix typo in file name * Update readme * update doc * Remove base dockerfile and update readme --------- Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu> Co-authored-by: Davor Runje <davor@airt.ai>
This commit is contained in:
parent
30b84d4254
commit
598a634665
|
@ -1,28 +1,43 @@
|
|||
# README for AutoGen Docker Samples
|
||||
# Dockerfiles and Devcontainer Configurations for AutoGen
|
||||
|
||||
Welcome to the `autogen/samples/dockers` directory! Here you'll find Dockerfiles that are essential for setting up your AutoGen development environment. Each Dockerfile is tailored for different use cases and requirements. Below is a brief overview of each and how you can utilize them effectively.
|
||||
Welcome to the `.devcontainer` directory! Here you'll find Dockerfiles and devcontainer configurations that are essential for setting up your AutoGen development environment. Each Dockerfile is tailored for different use cases and requirements. Below is a brief overview of each and how you can utilize them effectively.
|
||||
|
||||
These configurations can be used with Codespaces and locally.
|
||||
|
||||
## Dockerfile Descriptions
|
||||
|
||||
### Dockerfile.base
|
||||
### base
|
||||
|
||||
- **Purpose**: This Dockerfile is designed for basic setups. It includes common Python libraries and essential dependencies required for general usage of AutoGen.
|
||||
- **Purpose**: This Dockerfile, i.e., `./Dockerfile`, is designed for basic setups. It includes common Python libraries and essential dependencies required for general usage of AutoGen.
|
||||
- **Usage**: Ideal for those just starting with AutoGen or for general-purpose applications.
|
||||
- **Building the Image**: Run `docker build -f Dockerfile.base -t autogen_base_img .` in this directory.
|
||||
- **Building the Image**: Run `docker build -f ./Dockerfile -t autogen_base_img .` in this directory.
|
||||
- **Using with Codespaces**: `Code > Codespaces > Click on +` By default + creates a Codespace on the current branch.
|
||||
|
||||
### Dockerfile.full
|
||||
### full
|
||||
|
||||
- **Purpose**: This Dockerfile is for advanced features. It includes additional dependencies and is configured for more complex or feature-rich AutoGen applications.
|
||||
- **Purpose**: This Dockerfile, i.e., `./full/Dockerfile` is for advanced features. It includes additional dependencies and is configured for more complex or feature-rich AutoGen applications.
|
||||
- **Usage**: Suited for advanced users who need the full range of AutoGen's capabilities.
|
||||
- **Building the Image**: Execute `docker build -f Dockerfile.full -t autogen_full_img .`.
|
||||
- **Building the Image**: Execute `docker build -f full/Dockerfile -t autogen_full_img .`.
|
||||
- **Using with Codespaces**: `Code > Codespaces > Click on ...> New with options > Choose "full" as devcontainer configuration`. This image may require a Codespace with at least 64GB of disk space.
|
||||
|
||||
### Dockerfile.dev
|
||||
### dev
|
||||
|
||||
- **Purpose**: Tailored for AutoGen project developers, this Dockerfile includes tools and configurations aiding in development and contribution.
|
||||
- **Purpose**: Tailored for AutoGen project developers, this Dockerfile, i.e., `./dev/Dockerfile` includes tools and configurations aiding in development and contribution.
|
||||
- **Usage**: Recommended for developers who are contributing to the AutoGen project.
|
||||
- **Building the Image**: Run `docker build -f Dockerfile.dev -t autogen_dev_img .`.
|
||||
- **Building the Image**: Run `docker build -f dev/Dockerfile -t autogen_dev_img .`.
|
||||
- **Using with Codespaces**: `Code > Codespaces > Click on ...> New with options > Choose "dev" as devcontainer configuration`. This image may require a Codespace with at least 64GB of disk space.
|
||||
- **Before using**: We highly encourage all potential contributors to read the [AutoGen Contributing](https://microsoft.github.io/autogen/docs/Contribute) page prior to submitting any pull requests.
|
||||
|
||||
|
||||
### studio
|
||||
|
||||
- **Purpose**: Tailored for AutoGen project developers, this Dockerfile, i.e., `./studio/Dockerfile`, includes tools and configurations aiding in development and contribution.
|
||||
- **Usage**: Recommended for developers who are contributing to the AutoGen project.
|
||||
- **Building the Image**: Run `docker build -f studio/Dockerfile -t autogen_studio_img .`.
|
||||
- **Using with Codespaces**: `Code > Codespaces > Click on ...> New with options > Choose "studio" as devcontainer configuration`.
|
||||
- **Before using**: We highly encourage all potential contributors to read the [AutoGen Contributing](https://microsoft.github.io/autogen/docs/Contribute) page prior to submitting any pull requests.
|
||||
|
||||
|
||||
## Customizing Dockerfiles
|
||||
|
||||
Feel free to modify these Dockerfiles for your specific project needs. Here are some common customizations:
|
||||
|
@ -33,9 +48,9 @@ Feel free to modify these Dockerfiles for your specific project needs. Here are
|
|||
`FROM python:3.11-slim-bookworm` to `FROM python:3.10-slim-bookworm`
|
||||
- **Setting Environment Variables**: Add environment variables using the `ENV` command for any application-specific configurations. We have prestaged the line needed to inject your OpenAI_key into the docker environment as a environmental variable. Others can be staged in the same way. Just uncomment the line.
|
||||
`# ENV OPENAI_API_KEY="{OpenAI-API-Key}"` to `ENV OPENAI_API_KEY="{OpenAI-API-Key}"`
|
||||
- **Need a less "Advanced" Autogen build**: If the Dockerfile.full is to much but you need more than advanced then update this line in the Dockerfile.full file.
|
||||
- **Need a less "Advanced" Autogen build**: If the `./full/Dockerfile` is to much but you need more than advanced then update this line in the Dockerfile file.
|
||||
`RUN pip install pyautogen[teachable,lmm,retrievechat,mathchat,blendsearch] autogenra` to install just what you need. `RUN pip install pyautogen[retrievechat,blendsearch] autogenra`
|
||||
- **Can't Dev without your favorite CLI tool**: if you need particular OS tools to be installed in your Docker container you can add those packages here right after the sudo for the Dockerfile.base and Dockerfile.full files. In the example below we are installing net-tools and vim to the environment.
|
||||
- **Can't Dev without your favorite CLI tool**: if you need particular OS tools to be installed in your Docker container you can add those packages here right after the sudo for the `./base/Dockerfile` and `./full/Dockerfile` files. In the example below we are installing net-tools and vim to the environment.
|
||||
|
||||
```code
|
||||
RUN apt-get update \
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"dockerFile": "Dockerfile"
|
||||
}
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"dockerFile": "Dockerfile"
|
||||
}
|
|
@ -1,26 +0,0 @@
|
|||
FROM python:3.11-slim-bookworm
|
||||
|
||||
RUN apt-get update \
|
||||
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
||||
software-properties-common sudo\
|
||||
&& apt-get clean \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
# Setup a non-root user 'autogen' with sudo access
|
||||
RUN adduser --disabled-password --gecos '' autogen
|
||||
RUN adduser autogen sudo
|
||||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
|
||||
USER autogen
|
||||
WORKDIR /home/autogen
|
||||
|
||||
# Set environment variable if needed
|
||||
# ENV OPENAI_API_KEY="{OpenAI-API-Key}"
|
||||
|
||||
# Pre-load popular packages as per https://learnpython.com/blog/most-popular-python-packages/
|
||||
RUN pip install pyautogen numpy pandas matplotlib seaborn scikit-learn requests urllib3 nltk pillow pytest beautifulsoup4
|
||||
|
||||
# Expose port
|
||||
# EXPOSE 8081
|
||||
|
||||
# Start Command
|
||||
CMD [ "/bin/bash" ]
|
|
@ -98,7 +98,7 @@ For developers contributing to the AutoGen project, we offer a specialized Docke
|
|||
- **Purpose**: The `autogen_dev_img` is tailored for contributors to the AutoGen project. It includes a suite of tools and configurations that aid in the development and testing of new features or fixes.
|
||||
- **Usage**: This image is recommended for developers who intend to contribute code or documentation to AutoGen.
|
||||
- **Forking the Project**: It's advisable to fork the AutoGen GitHub project to your own repository. This allows you to make changes in a separate environment without affecting the main project.
|
||||
- **Updating Dockerfile.dev**: Modify your copy of `Dockerfile.dev` as needed for your development work.
|
||||
- **Updating Dockerfile**: Modify your copy of `Dockerfile` in the `dev` folder as needed for your development work.
|
||||
- **Submitting Pull Requests**: Once your changes are ready, submit a pull request from your branch to the upstream AutoGen GitHub project for review and integration. For more details on contributing, see the [AutoGen Contributing](https://microsoft.github.io/autogen/docs/Contribute) page.
|
||||
|
||||
### Building the Developer Docker Image
|
||||
|
@ -106,7 +106,7 @@ For developers contributing to the AutoGen project, we offer a specialized Docke
|
|||
- To build the developer Docker image (`autogen_dev_img`), use the following commands:
|
||||
|
||||
```bash
|
||||
docker build -f samples/dockers/Dockerfile.dev -t autogen_dev_img https://github.com/microsoft/autogen.git
|
||||
docker build -f .devcontainer/dev/Dockerfile -t autogen_dev_img https://github.com/microsoft/autogen.git
|
||||
```
|
||||
|
||||
- For building the developer image built from a specific Dockerfile in a branch other than main/master
|
||||
|
@ -119,7 +119,7 @@ For developers contributing to the AutoGen project, we offer a specialized Docke
|
|||
cd autogen
|
||||
|
||||
# build your Docker image
|
||||
docker build -f samples/dockers/Dockerfile.dev -t autogen_dev-srv_img .
|
||||
docker build -f .devcontainer/dev/Dockerfile -t autogen_dev-srv_img .
|
||||
```
|
||||
|
||||
### Using the Developer Docker Image
|
||||
|
@ -207,10 +207,10 @@ yarn start
|
|||
The last command starts a local development server and opens up a browser window.
|
||||
Most changes are reflected live without having to restart the server.
|
||||
|
||||
To build and test documentation within a docker container. Use the Dockerfile.dev as described above to build your image
|
||||
To build and test documentation within a docker container. Use the Dockerfile in the `dev` folder as described above to build your image
|
||||
|
||||
```bash
|
||||
docker build -f samples/dockers/Dockerfile.dev -t autogen_dev_img https://github.com/microsoft/autogen.git
|
||||
docker build -f .devcontainer/dev/Dockerfile -t autogen_dev_img https://github.com/microsoft/autogen.git
|
||||
```
|
||||
|
||||
Then start the container like so, this will log you in and ensure that Docker port 3000 is mapped to port 8081 on your local machine
|
||||
|
|
|
@ -4,9 +4,9 @@ AutoGen is a versatile tool that can be installed and run in Docker or locally u
|
|||
|
||||
## Option 1: Install and Run AutoGen in Docker
|
||||
|
||||
Docker, an indispensable tool in modern software development, offers a compelling solution for AutoGen's setup. Docker allows you to create consistent environments that are portable and isolated from the host OS. With Docker, everything AutoGen needs to run, from the operating system to specific libraries, is encapsulated in a container, ensuring uniform functionality across different systems. The Dockerfiles necessary for AutoGen are conveniently located in the project's GitHub repository at [https://github.com/microsoft/autogen/tree/main/samples/dockers](https://github.com/microsoft/autogen/tree/main/samples/dockers).
|
||||
Docker, an indispensable tool in modern software development, offers a compelling solution for AutoGen's setup. Docker allows you to create consistent environments that are portable and isolated from the host OS. With Docker, everything AutoGen needs to run, from the operating system to specific libraries, is encapsulated in a container, ensuring uniform functionality across different systems. The Dockerfiles necessary for AutoGen are conveniently located in the project's GitHub repository at [https://github.com/microsoft/autogen/tree/main/.devcontainer](https://github.com/microsoft/autogen/tree/main/.devcontainer).
|
||||
|
||||
**Pre-configured DockerFiles**: The AutoGen Project offers pre-configured Dockerfiles for your use. These Dockerfiles will run as is, however they can be modified to suit your development needs. Please see the README.md file in autogen/samples/dockers
|
||||
**Pre-configured DockerFiles**: The AutoGen Project offers pre-configured Dockerfiles for your use. These Dockerfiles will run as is, however they can be modified to suit your development needs. Please see the README.md file in autogen/.devcontainer
|
||||
|
||||
- **autogen_base_img**: For a basic setup, you can use the `autogen_base_img` to run simple scripts or applications. This is ideal for general users or those new to AutoGen.
|
||||
- **autogen_full_img**: Advanced users or those requiring more features can use `autogen_full_img`. Be aware that this version loads ALL THE THINGS and thus is very large. Take this into consideration if you build your application off of it.
|
||||
|
@ -21,16 +21,16 @@ Docker, an indispensable tool in modern software development, offers a compellin
|
|||
|
||||
AutoGen now provides updated Dockerfiles tailored for different needs. Building a Docker image is akin to setting the foundation for your project's environment:
|
||||
|
||||
- **Autogen Basic (dockerfile.base)**: Ideal for general use, this setup includes common Python libraries and essential dependencies. Perfect for those just starting with AutoGen.
|
||||
- **Autogen Basic**: Ideal for general use, this setup includes common Python libraries and essential dependencies. Perfect for those just starting with AutoGen.
|
||||
|
||||
```bash
|
||||
docker build -f samples/dockers/Dockerfile.base -t autogen_base_img https://github.com/microsoft/autogen.git
|
||||
docker build -f .devcontainer/base/Dockerfile -t autogen_base_img https://github.com/microsoft/autogen.git
|
||||
```
|
||||
|
||||
- **Autogen Advanced (dockerfile.full)**: Advanced users or those requiring all the things that AutoGen has to offer `autogen_full_img`
|
||||
- **Autogen Advanced**: Advanced users or those requiring all the things that AutoGen has to offer `autogen_full_img`
|
||||
|
||||
```bash
|
||||
docker build -f samples/dockers/Dockerfile.full -t autogen_full_img https://github.com/microsoft/autogen.git
|
||||
docker build -f .devcontainer/full/Dockerfile -t autogen_full_img https://github.com/microsoft/autogen.git
|
||||
```
|
||||
|
||||
### Step 3: Run AutoGen Applications from Docker Image
|
||||
|
@ -86,9 +86,11 @@ docker run -it -p {WorkstationPortNum}:{DockerPortNum} -v {WorkStation_Dir}:{Doc
|
|||
|
||||
#### Additional Resources
|
||||
|
||||
- Details on all the Dockerfile options can be found in the [Dockerfile](https://github.com/microsoft/autogen/.devcontainer/README.md) README.
|
||||
|
||||
- For more information on Docker usage and best practices, refer to the [official Docker documentation](https://docs.docker.com).
|
||||
|
||||
- Details on how to use the Dockerfile.dev version can be found on the [Contributing](Contribute.md#docker)
|
||||
- Details on how to use the Dockerfile dev version can be found on the [Contributing](Contribute.md#docker)
|
||||
|
||||
## Option 2: Install AutoGen Locally Using Virtual Environment
|
||||
|
||||
|
|
Loading…
Reference in New Issue