Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Wolfi images #47182

Merged
merged 58 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
49e572d
Add initial buildWolfiDockerImage implementation
willdollman Jan 31, 2023
1874e05
Add ops set for building wolfi images
willdollman Jan 31, 2023
77a7275
Build wolfi images on branches and tweak package/base logic
willdollman Jan 31, 2023
7c088d9
Build candidate wolfi image
willdollman Jan 31, 2023
d22c18a
Add wolfi-specific build scripts for gitserver
willdollman Jan 31, 2023
2146757
Move Wolfi build files from cmd/ to enterprise/cmd
willdollman Jan 31, 2023
b0012fe
Re-enable wolfi docker push
willdollman Jan 31, 2023
9c75a06
Add wolfi builds for frontend
willdollman Jan 31, 2023
818f95e
Add github-proxy wolfi build
willdollman Jan 31, 2023
16b0d48
Add loadtest wolfi build
willdollman Jan 31, 2023
44e1149
Add migrator build
willdollman Jan 31, 2023
ccf1cb0
Update wolfi base image location
willdollman Feb 2, 2023
ede1c66
Add wolfi builds for OSS frontend and gitserver
willdollman Feb 2, 2023
bf8afa8
Add enterprise/migrator build script
willdollman Feb 2, 2023
217df1a
Add wolfi builds for repo-updater
willdollman Feb 2, 2023
1d51b94
Add wolfi builds for searcher
willdollman Feb 2, 2023
1862fa6
Add wolfi builds for symbols
willdollman Feb 2, 2023
880f6b9
Build additional full images
willdollman Feb 2, 2023
fd4fafb
Add wolfi builds for batcheshelper
willdollman Feb 2, 2023
a1028a1
Add wolfi build for precise code intel
willdollman Feb 2, 2023
d17877c
Add wolfi build for enterprise worker
willdollman Feb 2, 2023
26af851
Fix wolfi base image for precise code intel
willdollman Feb 2, 2023
c81407c
Always build x86_64 Wolfi images
willdollman Feb 2, 2023
0a2cc44
Build symbols again
willdollman Feb 2, 2023
285fae4
Try using non-Alpine golang container for symbols build
willdollman Feb 2, 2023
2c9f4a3
Revert to alpine golang build env
willdollman Feb 2, 2023
fd8ee3d
Build full wolfi images on the bazel queue
willdollman Feb 3, 2023
3be6b3e
Disable building symbols and bazel runner for now
willdollman Feb 3, 2023
f687b20
Tweak local-build scripts
willdollman Feb 3, 2023
ce0fc9e
Add rough initial versions of server wolfi builds
willdollman Feb 3, 2023
8db3b56
Try building images with bazel agent again
willdollman Feb 3, 2023
f099623
Actually use bazel for gitserver builds
willdollman Feb 3, 2023
fdcc1a5
Build symbols in chainguard:go
willdollman Feb 3, 2023
33e275b
Build all Go binaries for Wolfi with Bazel
willdollman Feb 3, 2023
1e403d9
Add wolfi build scripts for embeddings image
willdollman Apr 7, 2023
157a7bd
Rough initial version of the server image
willdollman Apr 12, 2023
c37af38
Specify platform for symbols go-build
willdollman Apr 12, 2023
a31e23a
Build 3rd party Wolfi images (#47368)
willdollman Apr 20, 2023
4fedb1d
Add bind-tools to all base images
willdollman Apr 20, 2023
5754459
Make docker build commands more consistent
willdollman Apr 20, 2023
53b494a
Add wolfi build scripts for llm-proxy
willdollman Apr 20, 2023
4425f4d
Add wolfi build scripts for executor-kubernetes
willdollman Apr 20, 2023
5662a68
Update build-wolfi.sh scripts to match latest build.sh scripts
willdollman Apr 20, 2023
1771885
shellfmt build.sh scripts
willdollman Apr 20, 2023
1ed2df9
Set up proper deps for wolfi images and base images
willdollman Apr 20, 2023
4ab2586
Add buildAllBaseImages no-op command
willdollman Apr 20, 2023
095023a
Use stepKeys in wolfi base image dependencies
willdollman Apr 20, 2023
cb080df
Sanitize stepKeys
willdollman Apr 20, 2023
30a478d
Remove some completed TODOs
willdollman Apr 24, 2023
d8ece3f
Remove images from wolfi pipeline
willdollman Apr 24, 2023
0985a7c
Regenerate CI reference
willdollman Apr 24, 2023
110688a
Remove symbols build flag
willdollman Apr 24, 2023
2a89c24
Add hadolint ignores to use of latest with Wolfi images
willdollman Apr 24, 2023
55e5cb8
Fix CMD formatting
willdollman Apr 24, 2023
c1ebf0b
Fix symbols go-build script
willdollman Apr 24, 2023
681b821
Merge branch 'main' into wolfi/build-wolfi
willdollman Apr 24, 2023
7878dad
Specify exact Wolfi images to build
willdollman Apr 24, 2023
b4e44bb
sg generate
willdollman Apr 24, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update build-wolfi.sh scripts to match latest build.sh scripts
  • Loading branch information
willdollman committed Apr 20, 2023
commit 5662a681ea3105922ac0209aa3c0c8e1dd90961e
3 changes: 1 addition & 2 deletions cmd/frontend/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ export CGO_ENABLED=0

echo "--- go build"
pkg="github.com/sourcegraph/sourcegraph/cmd/frontend"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You didn't port the bazel build in that one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just been tracking what the build.sh script on main does, and for this image it doesn't use bazel - https://github.com/sourcegraph/sourcegraph/blob/main/cmd/frontend/build.sh

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's because in our branch, it's done in a build-bazel.sh

bazel run @go_sdk//:bin/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"
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 $IMAGE"
docker build -f cmd/frontend/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
21 changes: 19 additions & 2 deletions cmd/github-proxy/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,34 @@ cleanup() {
}
trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then

bazel build //cmd/github-proxy \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

out=$(bazel cquery //cmd/github-proxy --output=files)
cp "$out" "$OUTPUT"

docker build -f cmd/github-proxy/Dockerfile.wolfi -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"
bazel run @go_sdk//:bin/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"
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.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
20 changes: 18 additions & 2 deletions cmd/gitserver/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,33 @@ cleanup() {

trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then
bazel build //cmd/gitserver \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

out=$(bazel cquery //cmd/gitserver --output=files)
cp "$out" "$OUTPUT"

docker build -f cmd/gitserver/Dockerfile.wolfi -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/gitserver"
bazel run @go_sdk//:bin/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"
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/gitserver/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
21 changes: 19 additions & 2 deletions cmd/loadtest/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,34 @@ cleanup() {
}
trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then

bazel build //cmd/loadtest \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

out=$(bazel cquery //cmd/loadtest --output=files)
cp "$out" "$OUTPUT"

docker build -f cmd/loadtest/Dockerfile.wolfi -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/loadtest"
bazel run @go_sdk//:bin/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"
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/loadtest/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
30 changes: 26 additions & 4 deletions cmd/migrator/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,32 @@
# This script builds the migrator docker image.

cd "$(dirname "${BASH_SOURCE[0]}")/../.."
set -eu
set -ex

OUTPUT=$(mktemp -d -t sgdockerbuild_XXXXXXX)
cleanup() {
rm -rf "$OUTPUT"
}
trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then

bazel build //cmd/migrator \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

out=$(bazel cquery //cmd/migrator --output=files)
cp "$out" "$OUTPUT"

docker build -f cmd/migrator/Dockerfile.wolfi -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
Expand All @@ -21,7 +39,7 @@ echo "--- go build"
pkg=${1:-"github.com/sourcegraph/sourcegraph/cmd/migrator"}
output="$OUTPUT/$(basename "$pkg")"
# shellcheck disable=SC2153
bazel run @go_sdk//:bin/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" "$pkg"
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" "$pkg"

echo "--- compile schema descriptions"
mkdir -p "${OUTPUT}/schema-descriptions"
Expand Down Expand Up @@ -75,7 +93,12 @@ git_versions=(
v3.42.0 v3.42.1 v3.42.2
v3.43.0 v3.43.1 v3.43.2
v4.0.0 v4.0.1
v4.1.0 v4.1.1 v4.1.2
v4.1.0 v4.1.1 v4.1.2 v4.1.3
v4.2.0 v4.2.1
v4.3.0 v4.3.1
v4.4.0 v4.4.1 v4.4.2
v4.5.0 v4.5.1
v5.0.0
)
for version in "${git_versions[@]}"; do
echo "Persisting schemas for ${version} from Git..."
Expand All @@ -86,7 +109,6 @@ done

echo "--- docker build"
docker build -f cmd/migrator/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
21 changes: 19 additions & 2 deletions cmd/repo-updater/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,37 @@ OUTPUT=$(mktemp -d -t sgdockerbuild_XXXXXXX)
cleanup() {
rm -rf "$OUTPUT"
}

trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then
bazel build //cmd/repo-updater \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

out=$(bazel cquery //cmd/repo-updater --output=files)
cp "$out" "$OUTPUT"

docker build -f cmd/repo-updater/Dockerfile.wolfi -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

for pkg in $path_to_package; do
bazel run @go_sdk//:bin/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"
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"
done

docker build -f cmd/repo-updater/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
20 changes: 18 additions & 2 deletions cmd/searcher/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,33 @@ cleanup() {
}
trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then
bazel build //cmd/searcher \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

out=$(bazel cquery //cmd/searcher --output=files)
cp "$out" "$OUTPUT"

docker build -f cmd/searcher/Dockerfile.wolfi -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/searcher"
bazel run @go_sdk//:bin/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"
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/searcher/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
3 changes: 0 additions & 3 deletions cmd/server/build-wolfi.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#!/usr/bin/env bash

# TODO: This is untested and WIP

# We want to build multiple go binaries, so we use a custom build step on CI.
cd "$(dirname "${BASH_SOURCE[0]}")/../.."
set -eux
Expand Down Expand Up @@ -101,7 +99,6 @@ IMAGE=sourcegraph/blobstore:server docker-images/blobstore/build-wolfi.sh

echo "--- docker build"
docker build -f cmd/server/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
1 change: 0 additions & 1 deletion cmd/symbols/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ set -eu

echo "--- docker build symbols"
docker build -f cmd/symbols/Dockerfile.wolfi -t "$IMAGE" "$(pwd)" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
20 changes: 19 additions & 1 deletion cmd/worker/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ cleanup() {
}
trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then

bazel build //cmd/worker \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64

out=$(bazel cquery //cmd/worker --output=files)
cp "$out" "$OUTPUT"

docker build -f cmd/worker/Dockerfile.wolfi -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
Expand All @@ -22,7 +40,7 @@ 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" \
docker build -f cmd/worker/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
2 changes: 1 addition & 1 deletion enterprise/cmd/batcheshelper/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export GOOS=linux
export CGO_ENABLED=0

pkg="github.com/sourcegraph/sourcegraph/enterprise/cmd/batcheshelper"
bazel run @go_sdk//:bin/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"
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 enterprise/cmd/batcheshelper/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
Expand Down
21 changes: 19 additions & 2 deletions enterprise/cmd/frontend/build-wolfi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,24 @@ cleanup() {
}
trap cleanup EXIT

if [[ "${DOCKER_BAZEL:-false}" == "true" ]]; then
bazel build //enterprise/cmd/frontend \
--stamp \
--workspace_status_command=./dev/bazel_stamp_vars.sh \
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \
--//:assets_bundle_type=enterprise

out=$(bazel cquery //enterprise/cmd/frontend --output=files)
cp "$out" "$OUTPUT"

docker build -f enterprise/cmd/frontend/Dockerfile.wolfi -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
Expand All @@ -19,11 +37,10 @@ export CGO_ENABLED=0

echo "--- go build"
pkg="github.com/sourcegraph/sourcegraph/enterprise/cmd/frontend"
bazel run @go_sdk//:bin/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"
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 enterprise/cmd/frontend/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
9 changes: 4 additions & 5 deletions enterprise/cmd/gitserver/build-wolfi.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/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]}")"/../..
cd "$(dirname "${BASH_SOURCE[0]}")/../../.."
set -ex

OUTPUT=$(mktemp -d -t sgdockerbuild_XXXXXXX)
Expand All @@ -18,11 +18,10 @@ export GOARCH=amd64
export GOOS=linux
export CGO_ENABLED=0

pkg="github.com/sourcegraph/sourcegraph/cmd/gitserver"
bazel run @go_sdk//:bin/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"
pkg="github.com/sourcegraph/sourcegraph/enterprise/cmd/gitserver"
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/gitserver/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--platform="${PLATFORM:-linux/amd64}" \
docker build -f enterprise/cmd/gitserver/Dockerfile.wolfi -t "$IMAGE" "$OUTPUT" \
--progress=plain \
--build-arg COMMIT_SHA \
--build-arg DATE \
Expand Down
Loading