[Idea] Optimize Docker build for low-resource environments #11841
QuentinHsu
started this conversation in
Ideas
Replies: 1 comment 1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Describe the feature or potential improvement
Proposal to optimize Docker image build process, especially for developers and self-hosters running on low-resource machines.
Problem
Building Langfuse Docker images on machines with limited CPU/memory is currently painful:
webpackage takes 5+ minutes to compile even on decent hardwareFor self-hosters using small VPS instances (1-2 CPU, 2-4GB RAM) or developers on older machines, this makes the build process frustrating and time-consuming.
Proposed Solution
1. pnpm Cache Mount
Speed up dependency installation by caching pnpm store:
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile2. Enhanced
.dockerignoreReduce build context by excluding:
.turbo,dist,.next,node_modules)README.md,docs/,fern/)coverage/,playwright-report/).github,.devcontainer,scripts/)3. Worker Image Optimization
pnpm prune --prod/app4. Reduce Docker Layers
Combine multiple
RUNcommands to minimize layer count.Benchmark Results
The webpack compilation phase specifically improved from 2.9 minutes to 82 seconds (~53% faster).
Expected Impact
Happy to submit a PR if this direction makes sense.
Additional information
No response
All reactions