Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 3, 2025

Reduce agent container image size by ~40% (669MB → 404MB) by switching to a leaner base image and removing unnecessary packages.

Changes

  • Base image: ubuntu:22.04node:22-bookworm-slim (Node.js 22/npm/npx pre-installed)
  • Docker CLI: Multi-stage copy from docker:27.4.1-cli instead of apt install (avoids curl/gnupg deps)
  • Removed packages: dnsutils, net-tools, netcat-openbsd, curl, gnupg (none used in scripts)
  • Kept packages: iptables, git, ca-certificates
FROM node:22-bookworm-slim

# Copy Docker CLI from official image (no network deps)
COPY --from=docker:27.4.1-cli /usr/local/bin/docker /usr/local/bin/docker

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    iptables git ca-certificates && \
    apt-get clean && rm -rf /var/lib/apt/lists/*
Image Size
Previous 669MB
New 404MB

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • squid-proxy
    • Triggering command: /usr/bin/getent getent hosts squid-proxy (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

Slim down the agent container image and probably the only deps we need are npx / node / python and docker

first consider if the base image could be replaced with something lightweight


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI changed the title [WIP] Optimize agent container image size chore: slim down agent container image using node:22-bookworm-slim Dec 3, 2025
Copilot AI requested a review from Mossaka December 3, 2025 22:44
Copilot finished work on behalf of Mossaka December 3, 2025 22:44
@Mossaka Mossaka marked this pull request as ready for review December 4, 2025 02:05
@github-actions
Copy link

github-actions bot commented Dec 4, 2025

Test Coverage Report

Metric Coverage Covered/Total
Lines 67.21% 695/1034
Statements 67.35% 716/1063
Functions 70.24% 85/121
Branches 62.46% 228/365
Coverage Thresholds

The project has the following coverage thresholds configured:

  • Lines: 38%
  • Statements: 38%
  • Functions: 35%
  • Branches: 30%

Coverage report generated by `npm run test:coverage`

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