Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐋 ci: create smaller Docker images #2691

Merged
merged 1 commit into from
May 13, 2024

Conversation

derkoe
Copy link
Contributor

@derkoe derkoe commented May 13, 2024

Summary

This change reduces the size of the built Docker images significantly by removing the npm dev dependencies and the npm cache.

It also removes the workarounds for the broken ARM builds. This allows to use Node 20 for the main Docker build (as it is already with the Dockerfile.multi build). It seems with node:20-alpine and the flags set the build is pretty stable (also on ARM).

Changes of Docker image sizes:

Uncompressed images sizes:

REPOSITORY                    TAG       IMAGE ID       CREATED          SIZE
librechat/librechat-dev-api   latest    91b3ff876ac8   21 minutes ago   1.77GB
librechat/librechat-dev       latest    3faa53a2ccac   22 minutes ago   1.49GB
derkoe/librechat-dev-api      latest    900453f157c3   5 hours ago      593MB
derkoe/librechat-dev          latest    3a36052c1fe8   5 hours ago      680MB

Change Type

Docker build change - the rest of the code is not affected (not sure what to choose from the PR template list).

Testing

Checklist

Please delete any irrelevant options.

  • My code adheres to this project's style guidelines
  • I have performed a self-review of my own code
  • I have commented in any complex areas of my code
  • I have made pertinent documentation changes
  • My changes do not introduce new warnings
  • I have written tests demonstrating that my changes are effective or that my feature works
  • Local unit tests pass with my changes
  • Any changes dependent on mine have been merged and published in downstream modules.
  • New documents have been locally validated with mkdocs

- create fewer layers
- install only prod dependencies for final build
- clean npm cache
- fix layering in multi-image build
@derkoe derkoe force-pushed the ci/smaller-docker-image branch from 86d7802 to 076ae67 Compare May 13, 2024 14:34
@danny-avila
Copy link
Owner

Great, thank you! I will merge this and test the resulting images

@danny-avila danny-avila merged commit 5920672 into danny-avila:main May 13, 2024
@danny-avila
Copy link
Owner

so far so good 👍

danny-avila pushed a commit that referenced this pull request Aug 5, 2024
- create fewer layers
- install only prod dependencies for final build
- clean npm cache
- fix layering in multi-image build
kenshinsamue pushed a commit to intelequia/LibreChat that referenced this pull request Sep 17, 2024
- create fewer layers
- install only prod dependencies for final build
- clean npm cache
- fix layering in multi-image build
BertKiv pushed a commit to BertKiv/LibreChat that referenced this pull request Dec 10, 2024
- create fewer layers
- install only prod dependencies for final build
- clean npm cache
- fix layering in multi-image build
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants