@@ -87,6 +87,22 @@ To build specific libraries or binaries, you can specify the target:
8787make build TARGETS=" //pkg/tcpip:tcpip"
8888```
8989
90+ ### Building directly with Bazel (without Docker)
91+
92+ Using Bazel directly isn't recommended due to the extra overhead, but in order
93+ to get started:
94+
95+ - Look at the [ build dockerfile] ( images/default/Dockerfile ) for the canonical
96+ list of needed dependencies.
97+ - Install and use [ bazelisk] [ bazelisk ] . Otherwise, make sure your bazel
98+ version matches the one listed in the [ .bazelversion] ( .bazelversion ) file.
99+
100+ After setting up dependencies, using Bazel is similar to the Makefile:
101+
102+ ``` sh
103+ bazel build //runsc:runsc
104+ ```
105+
90106### Testing
91107
92108To run standard test suites, you can use:
@@ -99,17 +115,22 @@ make tests
99115To run specific tests, you can specify the target:
100116
101117``` sh
118+ # Makefile
102119make test TARGETS=" //runsc:version_test"
120+ # Bazel
121+ bazel test //runsc:version_test
103122```
104123
124+ ### Mac OS
125+
105126Some packages support running tests directly on macOS. At the time of this
106- writing, gVisor requires bazel 7 , which you can install via homebrew:
127+ writing, gVisor requires bazel 8 , which you can install via homebrew:
107128
108129``` sh
109- brew install bazel@7
130+ brew install bazel@8
110131
111132# You can then run the tests, e.g.:
112- $( brew --prefix bazel@7 ) /bin/bazel test --macos_sdk_version=$( xcrun --show-sdk-version) -- //tools/nogo/... //tools/check{aligned,const,escape,linkname,locks,unsafe}/...
133+ $( brew --prefix bazel@8 ) /bin/bazel test --macos_sdk_version=$( xcrun --show-sdk-version) -- //tools/nogo/... //tools/check{aligned,const,escape,linkname,locks,unsafe}/...
113134```
114135
115136### Using ` go get `
@@ -161,3 +182,4 @@ See [Contributing.md](CONTRIBUTING.md).
161182[ oci ] : https://www.opencontainers.org
162183[ old-linux ] : https://gvisor.dev/docs/user_guide/networking/#gso
163184[ sandbox ] : https://en.wikipedia.org/wiki/Sandbox_(computer_security)
185+ [ bazelisk ] : https://github.com/bazelbuild/bazelisk
0 commit comments