Skip to content

Reduce the docker image size using FROM scratch#176

Open
LucaDario wants to merge 2 commits into
sigbit:mainfrom
qomodome:main
Open

Reduce the docker image size using FROM scratch#176
LucaDario wants to merge 2 commits into
sigbit:mainfrom
qomodome:main

Conversation

@LucaDario

Copy link
Copy Markdown

Summary

This PR optimizes the containerization strategy by switching the final Docker image stage to FROM scratch, significantly reducing image size and attack surface while preserving runtime behavior.

Type of Change

  • feat: A new feature
  • fix: A bug fix
  • docs: Documentation only changes
  • style: Changes that do not affect the meaning of the code (white-space, formatting, missing semi-colons, etc)
  • refactor: A code change that neither fixes a bug nor adds a feature
  • perf: A code change that improves performance
  • test: Adding missing tests or correcting existing tests
  • build: Changes that affect the build system or external dependencies
  • ci: Changes to our CI configuration files and scripts
  • chore: Other changes that don't modify src or test files
  • revert: Reverts a previous commit

@LucaDario LucaDario requested a review from a team as a code owner June 17, 2026 14:44
@LucaDario LucaDario requested review from Copilot and hrntknr and removed request for a team June 17, 2026 14:44

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR updates the runtime container image to a minimal scratch base to reduce image size and remove unused OS packages.

Changes:

  • Switch runtime stage from debian:bookworm-slim to scratch.
  • Remove apt-get installs for certificates/tools/runtimes and instead copy the CA bundle from the builder stage.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Dockerfile
Comment on lines +15 to +17
FROM scratch

RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates curl python3 python3-pip nodejs npm \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
Comment thread Dockerfile
go build -trimpath -ldflags "-w -s" -o /app/bin/main .

FROM debian:bookworm-slim
FROM scratch
Comment thread Dockerfile
Comment on lines 19 to 20
COPY --from=builder /app/bin/main /usr/local/bin/mcp-auth-proxy
ENV DATA_PATH=/data
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