use multi-stage dockerfiles
Created by: ggilmore
Implements RFC 37: Use multi-stage Docker builds for Sourcegraph images
Overview
Before
- Generate assets in
buildkite-agent
's external environment, place them someOUTPUT
folder - Run
docker build ... $OUTPUT
, which passes the folder containing the assets as the Docker buildcontext
- Downloads any extra dependencies and copies over the assets into the final image
After
- Run
docker build ... $(pwd)
, which passes a plain checkout of https://github.com/sourcegraph/sourcegraph as the build context
build.sh
scripts
All the cmd/**/build.sh
scripts have refactored to only do the raw steps of building the binary. The actual "docker build" call has been moved to cmd/**/docker.sh
scripts. This provides a cleaner separation of concerns, and makes it easier to re-use the build.sh
scripts in different contexts.