ItzCrazyKns / Perplexica

Perplexica is an AI-powered search engine. It is an Open source alternative to Perplexity AI
MIT License
10.84k stars 957 forks source link

feat: build docker images in CI #231

Open nperez0111 opened 5 days ago

nperez0111 commented 5 days ago

Hi, really like the project. I wanted to have docker images that were already pre-built to self-host. So, I got the project building in GitHub Container Registry & built automatically in CI.

Definitely some optimizations could be made to the Docker images to get this to work better though like:

  1. We could leverage Docker multi-stage builds to reduce final image size
  2. We could pick a better base image (seems like the current base image is bundling python? That doesn't seem neccessary & I could build it without it. I didn't include it in the PR because I wasn't totally sure if this was needed for a feature that I did not know about)
  3. I found the build times to be extremely slow. I think it is because I'm doing a multiple architecture build but I actually checked and saw that yarn installs were a good chunk of the time. Could have a cache between them or honestly just switch from yarn since it is known to be slow at resolving. (I already added frozen-lockfiles which was a significant speedup)

One thing that I had to do though, we not modify the config file (since that is better handled by a volume) at build time to include the build time arg. So what I did was make env vars be a fallback for values that are actually specified in the config (so updating the config should always override an env var declarations)

You can see the docker images (and pull them if you like!) here:

akramer-zibra commented 5 days ago

@ItzCrazyKns This looks like a professional enhancement to this lovely project. +1 for this

ItzCrazyKns commented 5 days ago

Hey @nperez0111, thanks for the PR! All of the changes looks good but I cannot merge the CI pipeline for the docker image building as if the config.toml file doesn't gets configured correctly, the page won't load and it would throw an error, some of the fields are still not present in the config menu to be configured from the frontend so that might cause an issue, we can implement the CI part later when these things are implemented.