Skip to content

[enhancement] reduce the number of filesystem layers #273

@acavalin

Description

@acavalin

Hello,

the Dockerfile has 6 COPY instructions, each of them creates a dedicated filesystem layer within the image, and best practice is to minimize the layer count.

I suggest to squeeze them into a single one by simply reorganizing files in the context:

  • Dockerfile before:
COPY       /configs/supervisord.conf     /etc/supervisord.conf
COPY       /configs/rsyslog*.conf        /etc/
COPY       /configs/opendkim.conf        /etc/opendkim/opendkim.conf
COPY       /configs/smtp_header_checks   /etc/postfix/smtp_header_checks
COPY       /configs/master.cf            /etc/postfix/master.cf
COPY       /scripts/*                    /scripts/
  • Dockerfile after:
COPY       /image_root/ /
  • Context reorganization:
mkdir -p image_root/{etc,opendkim,postfix}
mv configs/supervisord.conf    image_root/etc/
mv configs/rsyslog*.conf       image_root/etc/
mv configs/opendkim.conf       image_root/opendkim/
mv configs/smtp_header_checks  image_root/postfix/
mv configs/master.cf           image_root/postfix/
mv scripts                     image_root/

Hope it helps ☺️

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions