langgenius / dify-sandbox

A lightweight, fast, and secure code execution environment that supports multiple programming languages
https://docs.dify.ai/development/backend/sandbox
Apache License 2.0
443 stars 97 forks source link

Can we add more lib packages like CV2 or Pilllow ? #56

Open nhha1602 opened 2 months ago

nhha1602 commented 2 months ago

Hi, I'm new with sandbox, I just want to know if I can add more lib packages like CV2 or Pillow for image processing ? If yes, please show me how.

Thanks and regards.

Korayem commented 2 months ago

Related https://github.com/langgenius/dify-sandbox/issues/37

sharptornadoqsh commented 2 months ago

1、find the linux pakages the CV2 or Pillow needs and add them in conf file which shows in the FAQ

2、find the system call CV2 or Pillow needs and add it in the https://github.com/langgenius/dify-sandbox/blob/main/internal/static/python_syscall/syscalls_amd64.go

if you do not konw you can add all the sys call 。such as from number 0 to 500 0,1,2,3,4,5...500

3、add the linxu package and apt-install them in the docker file

4、build the source code and rewrite the dockfile file(pip3 install your package )

nhha1602 commented 2 months ago

1、find the linux pakages the CV2 or Pillow needs and add them in conf file which shows in the FAQ

2、find the system call CV2 or Pillow needs and add it in the https://github.com/langgenius/dify-sandbox/blob/main/internal/static/python_syscall/syscalls_amd64.go

if you do not konw you can add all the sys call 。such as from number 0 to 500 0,1,2,3,4,5...500

3、add the linxu package and apt-install them in the docker file

4、build the source code and rewrite the dockfile file(pip3 install your package )

These are the steps for creating new dockerfile of sandbox to support cv2/Pillow or these are solutions for it?

Thank you :)