Use set -ex in RUN command of Dockerfile, in analyzer projects

Summary

In the Dockerfile of the analyzer projects, in the RUN command, start with set -ex and chain commands using ;, instead of &&.

To illustrate, a Dockerfile containing this:

RUN apt-get update && \
    apt-get install -y --no-install-recommends git && \
    rm -rf /var/lib/apt/lists/*

would change to that:

RUN set -ex; \
    \
    apt-get update; \
    apt-get install -y --no-install-recommends git; \
    rm -rf /var/lib/apt/lists/*

See gitlab-org/security-products/analyzers/bundler-audit!41 (comment 358023708)

Improvements

  • Shell commands are easier to chain, using ;.
  • The build job echoes the Shell commands that are executed, when building the Docker image.

Risks

None.

Involved components

All analyzer projects.

Optional: Intended side effects

Optional: Missing test coverage

None. A broken RUN command would make the build job fail.

/cc @adamcohen @theoretick @gonzoyumo