Support `copies` config entry for multi-stage builds

Authored by dduvall on Aug 30 2017, 4:47 PM.


Support copies config entry for multi-stage builds

Support a copies variant config entry that will result in a
multi-stage build, copying both shared library files and application
directory from a previously defined variant. This is essentially a
shorthand for two artifacts entries that are likely to be idiomatic to
multi-stage build/prod configurations.

Defined a new abstract build.CopyFrom instruction and corresponding
docker.DockerCopyFrom instruction and refactored the writing of these
Dockerfile lines to be accomplished using an InstructionsForPhase
method on config.ArtifactsConfig.

Implemented new support for copies configuration in
config.VariantConfig and an InstructionsForPhase method that returns
build.CopyFrom instructions for both the shared library and
application directories.

Fixes T174622
Depends on D759

Test Plan:
Run go test ./.... Run blubber blubber.example.yaml production and ensure
the right COPY --from lines are included for the final stage.

Reviewers: thcipriani, mobrovac, hashar, mmodell, Release-Engineering-Team

Reviewed By: thcipriani, Release-Engineering-Team

Tags: Release-Engineering-Team

Maniphest Tasks: T174622

Differential Revision: https://phabricator.wikimedia.org/D768