projectatomic / container-best-practices

Container Best Practices
Other
166 stars 70 forks source link

New formatting style of RUN sections #128

Closed matejak closed 6 years ago

matejak commented 6 years ago

I propose an improvement style for RUN directives in Dockerfiles.

In a nutshell, it is a shift from

RUN dnf install -y --setopt=tsflags=nodocs \
    httpd vim && \
    systemctl enable httpd && \
    dnf clean all

to

RUN true \
    && dnf install -y --setopt=tsflags=nodocs \
        httpd vim \
    && systemctl enable httpd \
    && dnf clean all \
    && true

Advantages of using this style include:

I don't perceive the current proposed RUN formatting style as flawed, but this one is better in some aspects and not worse in a single aspect. Moreover, if you will use this style for a while, you will not want to go back.

eliskasl commented 6 years ago

Looks good. Thank you!