mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 16:51:55 +00:00
Reintroduces the same changes as https://github.com/sourcegraph/sourcegraph/pull/51104 minus syntax-highlighter which we're unable to compile with the right toolchain at the moment. Tested as a full main-dry-run, as well as running the stack with compose and checking indexing and syntax-highlighting. Executors are also built correctly. ## Test plan CI + manual test via compose. --------- Co-authored-by: Jean-Hadrien Chabran <jh@chabran.fr>
44 lines
1.3 KiB
Bash
Executable File
44 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# We want to build multiple go binaries, so we use a custom build step on CI.
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"/../..
|
|
set -ex
|
|
|
|
OUTPUT=$(mktemp -d -t sgdockerbuild_XXXXXXX)
|
|
cleanup() {
|
|
rm -rf "$OUTPUT"
|
|
}
|
|
trap cleanup EXIT
|
|
|
|
if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then
|
|
./dev/ci/bazel.sh build //cmd/github-proxy \
|
|
--stamp \
|
|
--workspace_status_command=./dev/bazel_stamp_vars.sh \
|
|
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64
|
|
|
|
out=$(./dev/ci/bazel.sh cquery //cmd/github-proxy --output=files)
|
|
cp "$out" "$OUTPUT"
|
|
|
|
docker build -f cmd/github-proxy/Dockerfile -t "$IMAGE" "$OUTPUT" \
|
|
--progress=plain \
|
|
--build-arg COMMIT_SHA \
|
|
--build-arg DATE \
|
|
--build-arg VERSION
|
|
exit $?
|
|
fi
|
|
|
|
# Environment for building linux binaries
|
|
export GO111MODULE=on
|
|
export GOARCH=amd64
|
|
export GOOS=linux
|
|
export CGO_ENABLED=0
|
|
|
|
pkg="github.com/sourcegraph/sourcegraph/cmd/github-proxy"
|
|
go build -trimpath -ldflags "-X github.com/sourcegraph/sourcegraph/internal/version.version=$VERSION -X github.com/sourcegraph/sourcegraph/internal/version.timestamp=$(date +%s)" -buildmode exe -tags dist -o "$OUTPUT/$(basename $pkg)" "$pkg"
|
|
|
|
docker build -f cmd/github-proxy/Dockerfile -t "$IMAGE" "$OUTPUT" \
|
|
--progress=plain \
|
|
--build-arg COMMIT_SHA \
|
|
--build-arg DATE \
|
|
--build-arg VERSION
|