Update build instructions (#2136)

* Update build instructions

Signed-off-by: Brad Davidson <brad.davidson@rancher.com>
pull/2142/head
Brad Davidson 2020-08-18 14:34:10 -07:00 committed by GitHub
parent 4e990b408c
commit e826439e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 19 deletions

View File

@ -1,39 +1,28 @@
See the [release](https://github.com/rancher/k3s/releases/latest) page for pre-built releases.
The clone will be much faster on this repo if you do
```bash
git clone --depth 1 https://github.com/rancher/k3s.git
```
This repo includes all of Kubernetes history so `--depth 1` will avoid most of that.
To build the full release binary run `make` and that will create `./dist/artifacts/k3s`.
Optionally to build the binaries using local Go environment without running linting or building docker images:
The k3s build process requires some autogenerated code and remote artifacts that are not checked in to version control.
To prepare these resources for your build environment, run:.
```bash
./scripts/download && ./scripts/build && ./scripts/package-cli
mkdir -p build/data && ./scripts/download && go generate
```
For development, you just need go 1.12+ and a proper GOPATH. To compile the binaries run:
To build the full release binary, you may now run `make`, which will create `./dist/artifacts/k3s`.
To build the binaries using without running linting (ie; if you have uncommitted changes):
```bash
go build -o k3s
go build -o kubectl ./cmd/kubectl
go build -o hyperkube ./vendor/k8s.io/kubernetes/cmd/hyperkube
SKIP_VALIDATE=true make
```
This will create the main executable at `./dist/artifacts` , but it does not include the dependencies like containerd, CNI,
etc. To run a server and agent with all the dependencies for development run the following
helper scripts:
If you make any changes to go.mod and want to update the vendored modules, you should run the following before runnining `make`:
```bash
# Server
./scripts/dev-server.sh
# Agent
./scripts/dev-agent.sh
go mod vendor && go mod tidy
```
Kubernetes Source