devika icon indicating copy to clipboard operation
devika copied to clipboard

[Improve] Improved Docker build

Open lehcode opened this issue 1 year ago • 13 comments

This commit provides an improved Docker build

  • Adds build caching
  • Adds and configures Miniconda environment with GPU driver support.
  • Adds the ability to sync local and Docker environments with Conda and environment.yml.
  • Adds name to devika-backend-engine service image.
  • Adds hostnames additionally to service names to simplify container communication by shorter and more convenient host names.
  • Implements various environment variables for optimization.
  • Patches source files at the image build stage for seamless Docker support
  • Replace UI package manager with Yarn, which does not require additional installation
  • Replaces base UI image with node:18.20.2-bullseye, which provides the node out-of-the-box.
  • Replaces base image of backend service to python:3.11.9-bookworm with Python 3.11 preinstalled.

lehcode avatar Apr 30 '24 05:04 lehcode

remove the lock file

ARajgor avatar Apr 30 '24 16:04 ARajgor

also how much each the size of the containers?

ARajgor avatar Apr 30 '24 16:04 ARajgor

Thanks for the prompt reply, @ARajgor!

Preparing another commit with hotfixes. I knew you'd ask ) All containers that use CUDA are large because CUDA is large. I coded from the view that size matters at the release stage, while the current one seems to be an active development, so I did not add any cleanup code and added caching, which speeds up rebuilds, even if I suspect that the price is image size or other disk resources. I know how to optimize images for production later.

lehcode avatar Apr 30 '24 17:04 lehcode

devika-backend-engine-1 | Traceback (most recent call last): devika-backend-engine-1 | File "", line 198, in _run_module_as_main devika-backend-engine-1 | File "", line 88, in _run_code devika-backend-engine-1 | File "/home/nonroot/devika/devika.py", line 8, in devika-backend-engine-1 | init_devika() devika-backend-engine-1 | File "/home/nonroot/devika/src/init.py", line 7, in init_devika devika-backend-engine-1 | logger = Logger() devika-backend-engine-1 | ^^^^^^^^ devika-backend-engine-1 | File "/home/nonroot/devika/src/logger.py", line 11, in init devika-backend-engine-1 | config = Config() devika-backend-engine-1 | ^^^^^^^^ devika-backend-engine-1 | File "/home/nonroot/devika/src/config.py", line 11, in new devika-backend-engine-1 | cls._instance._load_config() devika-backend-engine-1 | File "/home/nonroot/devika/src/config.py", line 23, in _load_config devika-backend-engine-1 | with open("sample.config.toml", "r") as f: devika-backend-engine-1 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ devika-backend-engine-1 | FileNotFoundError: [Errno 2] No such file or directory: 'sample.config.toml' devika-backend-engine-1 exited with code 1

StuckInLoop avatar Apr 30 '24 22:04 StuckInLoop

I'm not sure if this is related to this specific PR. Original sample.config.toml must exist. Check if working directory contains it in container

lehcode avatar Apr 30 '24 22:04 lehcode

  • Removes bun lock file
  • Fixes missing playwright browser error on task completion

lehcode avatar May 01 '24 05:05 lehcode

@ARajgor docker-compose build should run smoothly now

lehcode avatar May 01 '24 05:05 lehcode

you didn't remove the yarn.lock

ARajgor avatar May 01 '24 07:05 ARajgor

devika is using bun as it default package manager. bun.lockb is already included in the repo.

nalaso avatar May 01 '24 09:05 nalaso

@nalaso, the reasoning is mentioned in the PR description: "Replace UI package manager with Yarn, which does not require additional installation" I don't care about specific PM. Feel free to revert bun.lock and npm install bun back.

lehcode avatar May 01 '24 09:05 lehcode

how about using oven/bun? also the app can work with just Bun

Polygons1 avatar May 02 '24 08:05 Polygons1

No problem about Bun. This is based on my project, which uses Yarn as a package manager. Feel free to replace it with Bun or anything.

On Thu, May 2, 2024 at 11:45 AM Polygons1 @.***> wrote:

how about using oven/bun? also the app can work with just Bun

— Reply to this email directly, view it on GitHub https://github.com/stitionai/devika/pull/514#issuecomment-2089920148, or unsubscribe https://github.com/notifications/unsubscribe-auth/AMYTLKG2NQ7EJALMLG54TKTZAH4J5AVCNFSM6AAAAABG7RHPVSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAOBZHEZDAMJUHA . You are receiving this because you authored the thread.Message ID: @.***>

lehcode avatar May 02 '24 13:05 lehcode