Update builds docs (#1151)

## Description

Adds more info in the build docs for building corso binary locally or using containers. Also improved docs on building corso container image.

@gmatev let me know if I should add anything else specifically to the docs.

## Type of change

<!--- Please check the type of change your PR introduces: --->
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [x] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [ ] 🐹 Trivial/Minor

## Issue(s)

<!-- Can reference multiple issues. Use one of the following "magic words" - "closes, fixes" to auto-close the Github issue. -->
* fixes #684

## Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [ ]  Unit test
- [ ] 💚 E2E
This commit is contained in:
Abin Simon 2022-10-14 04:37:59 +05:30 committed by GitHub
parent e5243404a8
commit 1c5f3d631d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 7 deletions

View File

@ -20,7 +20,9 @@ BasedOnStyles = Vale, Microsoft, proselint, write-good, alex
# - corso command line examples first line in a bash code block starting with `corso`
BlockIgnores = (\{\#.*?\}), \
(import.*?from.*?;),\
(?s) (```bash.*?corso.*?$)
(?s) (```bash.*?corso.*?$), \
(?s) (```bash.*?\/build.*?$)
[*.json]
BasedOnStyles = Vale

View File

@ -1,20 +1,63 @@
# Building Corso
## Binary
### Building locally
Corso is a Go project, and you can build it with `go build` from `<repo root>/src`
if you have Go installed on your system.
```bash
# run from within `./src`
go build -o corso
```
:::info
If you dong have Go available, you can find installation instructions [here](https://go.dev/doc/install)
:::
This will generate a binary named `corso` in the directory where you run the build.
### Building via Docker
For convenience, the Corso build tooling is containerized. To take advantage, you need
[Docker](https://www.docker.com/) installed on your machine.
To build Corso locally, use the following command from the root of your repo:
To build Corso via docker, use the following command from the root of your repo:
```bash
./build/build.sh
./build/build.sh
```
The resulting binary will be under `<repo root>/bin`
You can pass in all the architectures/platforms you would like to
build it for using the `--platforms` flag as a comma separated
list. For example, if you would like to build `amd64` and `arm64`
versions for Linux, you can run the following command:
If you prefer to build Corso as a container, use the following command:
```bash
./build/build.sh --platforms linux/amd64,linux/arm64
```
Once built, the resulting binaries will be available in `<repo root>/bin` for all the different platforms you specified.
## Container Image
If you prefer to build Corso as a container image, use the following command instead:
```bash
# Use --help to see all available options
./build/build-container.sh
./build/build-container.sh
```
Below are the main customization flags that you can set when building a container image:
- `-a|--arch`: Set the architecture to the specified value. (default: amd64)
- `-l|--local`: Build the corso binary on your local system, rather than a go image.
- `-p|--prefix`: Prefix for the image name.
- `-s|--suffix`: Suffix for the version.
For example, you can use the following command to create a `arm64` image with prefix of `ghcr.io` and the tag as `nightly`.
```bash
./build/build-container.sh --arch arm64 --prefix ghcr.io --suffix nightly
```