Skip to content

Conversation

@Pouyanpi
Copy link
Collaborator

Description

Switch base image from python:3.10 to python:3.12-slim for improved performance and smaller image size. Use --no-install-recommends for apt package installation and clean up apt cache to reduce final image size.

Related Issue(s)

Checklist

  • I've read the CONTRIBUTING guidelines.
  • I've updated the documentation if applicable.
  • I've added tests if applicable.
  • @mentions of the person or team responsible for reviewing proposed changes.

Switch base image from python:3.10 to python:3.12-slim for improved
performance and smaller image size. Use --no-install-recommends for apt
package installation and clean up apt cache to reduce final image size.
@Pouyanpi Pouyanpi added this to the 0.20.0 milestone Nov 28, 2025
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Nov 28, 2025

Greptile Overview

Greptile Summary

Upgraded Docker base image from python:3.10 to python:3.12-slim and implemented Docker best practices for image size optimization.

Key Changes:

  • Base image changed to python:3.12-slim for improved performance and reduced image size
  • Added --no-install-recommends flag to apt-get install to avoid unnecessary packages
  • Added cache cleanup (rm -rf /var/lib/apt/lists/*) in the same RUN layer to reduce final image size

Compatibility:

  • Python 3.12 is fully supported according to pyproject.toml (supports Python >=3.10,<3.14)
  • All dependencies have appropriate version constraints for Python 3.12

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The changes are well-structured and follow Docker best practices. Python 3.12 is officially supported by the project (as confirmed in pyproject.toml line 48), and the slim variant + optimization techniques will reduce image size without affecting functionality. The modifications are contained to a single file with no breaking changes.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
Dockerfile 5/5 Upgraded base image from python:3.10 to python:3.12-slim and applied Docker best practices for apt cache cleanup and minimal package installation

Sequence Diagram

sequenceDiagram
    participant User
    participant Docker
    participant BaseImage as python:3.12-slim
    participant AptGet as apt-get
    participant Poetry
    participant NemoGuardrails

    User->>Docker: docker build
    Docker->>BaseImage: FROM python:3.12-slim
    BaseImage-->>Docker: Base image loaded
    
    Docker->>AptGet: apt-get update
    Docker->>AptGet: apt-get install --no-install-recommends git gcc g++
    AptGet-->>Docker: Dependencies installed
    Docker->>AptGet: rm -rf /var/lib/apt/lists/*
    Note over AptGet,Docker: Cache cleanup reduces image size
    
    Docker->>Docker: Set POETRY_VERSION=1.8.2
    Docker->>Poetry: pip install poetry
    Poetry-->>Docker: Poetry installed
    
    Docker->>Docker: Copy pyproject.toml & poetry.lock
    Docker->>Docker: Copy project files
    Docker->>Poetry: poetry install --all-extras
    Poetry-->>Docker: Dependencies installed
    
    Docker->>NemoGuardrails: Download embedding model
    Docker->>NemoGuardrails: Test CLI (--help)
    Docker->>Poetry: Final poetry install
    
    Docker-->>User: Image ready with Python 3.12
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

@Pouyanpi Pouyanpi self-assigned this Nov 28, 2025
@codecov
Copy link

codecov bot commented Nov 28, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

3 participants