Skip to content

feat: multi-stage Dockerfile to reduce addon image size#293

Draft
Copilot wants to merge 1 commit into
mainfrom
copilot/improve-extension-installation-time
Draft

feat: multi-stage Dockerfile to reduce addon image size#293
Copilot wants to merge 1 commit into
mainfrom
copilot/improve-extension-installation-time

Conversation

Copilot AI commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

The addon installs slowly because the final image was built directly FROM ghostfolio/ghostfolio, inheriting yarn, build tooling, and OS packages that aren't needed at runtime (~302 MB compressed before our layers).

Dockerfile — multi-stage build

  • Stage 1 (ghostfolio-source): ghostfolio/ghostfolio used as source only — nothing lands in the final image except what's explicitly copied
  • Stage 2 (final): node:22-bookworm-slim — the same clean base the upstream ghostfolio image itself uses; strips yarn, build tools, and all upstream cruft
  • COPY --from=ghostfolio-source --chown=node:node /ghostfolio /ghostfolio — only app files cross the stage boundary
  • --no-install-recommends on apt-get install; redisredis-server (drops unused CLI); curl and openssl added explicitly (previously inherited from base)

Run script

  • yarn start:productionexec /ghostfolio/entrypoint.sh
  • The upstream entrypoint does the same work: prisma migrate + seed + node main, without yarn
  • exec makes node a direct child of s6, improving signal handling and eliminating the yarn process overhead; yarn is no longer required in the image

BUILD_FROM build arg and build.json are unchanged — the ghostfolio source image is still pinned per-architecture as before.

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