You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

docker.md 3.0 kB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. # Docker for Development
  2. For developers contributing to the AutoGen project, we offer a specialized Docker environment. This setup is designed to streamline the development process, ensuring that all contributors work within a consistent and well-equipped environment.
  3. ## Autogen Developer Image (autogen_dev_img)
  4. - **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.
  5. - **Usage**: This image is recommended for developers who intend to contribute code or documentation to AutoGen.
  6. - **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.
  7. - **Updating Dockerfile**: Modify your copy of `Dockerfile` in the `dev` folder as needed for your development work.
  8. - **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.
  9. ## Building the Developer Docker Image
  10. - To build the developer Docker image (`autogen_dev_img`), use the following commands:
  11. ```bash
  12. docker build -f .devcontainer/dev/Dockerfile -t autogen_dev_img https://github.com/microsoft/autogen.git#main
  13. ```
  14. - For building the developer image built from a specific Dockerfile in a branch other than main/master
  15. ```bash
  16. # clone the branch you want to work out of
  17. git clone --branch {branch-name} https://github.com/microsoft/autogen.git
  18. # cd to your new directory
  19. cd autogen
  20. # build your Docker image
  21. docker build -f .devcontainer/dev/Dockerfile -t autogen_dev-srv_img .
  22. ```
  23. ## Using the Developer Docker Image
  24. Once you have built the `autogen_dev_img`, you can run it using the standard Docker commands. This will place you inside the containerized development environment where you can run tests, develop code, and ensure everything is functioning as expected before submitting your contributions.
  25. ```bash
  26. docker run -it -p 8081:3000 -v `pwd`/autogen-newcode:newstuff/ autogen_dev_img bash
  27. ```
  28. - Note that the `pwd` is shorthand for present working directory. Thus, any path after the pwd is relative to that. If you want a more verbose method you could remove the "`pwd`/autogen-newcode" and replace it with the full path to your directory
  29. ```bash
  30. docker run -it -p 8081:3000 -v /home/AutoGenDeveloper/autogen-newcode:newstuff/ autogen_dev_img bash
  31. ```
  32. ## Develop in Remote Container
  33. If you use vscode, you can open the autogen folder in a [Container](https://code.visualstudio.com/docs/remote/containers).
  34. We have provided the configuration in [devcontainer](https://github.com/microsoft/autogen/blob/main/.devcontainer). They can be used in GitHub codespace too. Developing AutoGen in dev containers is recommended.