mirror of
https://github.com/sourcegraph/sourcegraph.git
synced 2026-02-06 19:21:50 +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>
43 lines
1.2 KiB
Bash
43 lines
1.2 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
# This script builds the worker docker image.
|
|
|
|
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/worker
|
|
out=$(./dev/ci/bazel.sh cquery //cmd/worker --output=files)
|
|
cp "$out" "$OUTPUT"
|
|
|
|
docker build -f cmd/worker/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
|
|
|
|
echo "--- go build"
|
|
pkg="github.com/sourcegraph/sourcegraph/cmd/worker"
|
|
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"
|
|
|
|
echo "--- docker build"
|
|
docker build -f cmd/worker/Dockerfile -t "$IMAGE" "$OUTPUT" \
|
|
--progress=plain \
|
|
--build-arg COMMIT_SHA \
|
|
--build-arg DATE \
|
|
--build-arg VERSION
|