Page MenuHomePhabricator

Shorthand for standard multi-stage artifact config
Closed, ResolvedPublic

Description

The standard pattern for doing multi-stage builds is to copy artifacts from a build container into a final image. This is supported in Blubber currently but requires the config to contain manually defined artifact entires for both the shared lib directory and the application directory. Since this patterns is very likely to be repeated for all cases that use multi-stage, it seems reasonable to create a shorthand for it.

Current form using manually defined artifacts config:

base: docker-registry.wikimedia.org/nodejs-slim
runs:
  in: /srv/service

variants:
  build:
    base: docker-registry.wikimedia.org/nodejs-devel
    node:
      dependencies: true
      env: production
  production:
    node:
      env: production
    artifacts:
      - from: build
        source: /opt/local
        destination: /opt/local
      - from: build
        source: /srv/service
        destination: .
    entrypoint: [node, server.js]

Proposed alternative using a copies config entry:

base: docker-registry.wikimedia.org/nodejs-slim
runs:
  in: /srv/service

variants:
  build:
    base: docker-registry.wikimedia.org/nodejs-devel
    node:
      dependencies: true
      env: production
  production:
    node:
      env: production
    copies: build
    entrypoint: [node, server.js]