refactor: Add install script for coder CLI (#243)

This adds a `make install` target that copies the CLI and other coder binaries to `$GOPATH/bin` Intended to be helpful for developers who aren't familiar with `go` or the directory structure, in running `coder` CLI locally.
This commit is contained in:
Bryan 2022-02-10 20:32:00 -08:00 committed by GitHub
parent a82fb8f726
commit c0d547b6a2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 0 deletions

View File

@ -1,3 +1,5 @@
INSTALL_DIR=$(shell go env GOPATH)/bin
bin/coder:
mkdir -p bin
go build -o bin/coder cmd/coder/main.go
@ -51,6 +53,12 @@ fmt: fmt/prettier fmt/sql
gen: database/generate peerbroker/proto provisionersdk/proto provisionerd/proto
.PHONY: gen
install:
@echo "--- Copying from bin to $(INSTALL_DIR)"
cp -r ./bin $(INSTALL_DIR)
@echo "-- CLI available at $(shell ls $(INSTALL_DIR)/coder*)"
.PHONY: install
peerbroker/proto: peerbroker/proto/peerbroker.proto
protoc \
--go_out=. \

View File

@ -15,6 +15,13 @@ This repository contains source code for Coder V2. Additional documentation:
## Development
### Pre-requisites
- `git`
- `go` version 1.17, with the `GOPATH` environment variable set
- `node`
- `yarn`
### Cloning
- `git clone https://github.com/coder/coder`
@ -23,6 +30,9 @@ This repository contains source code for Coder V2. Additional documentation:
### Building
- `make build`
- `make install`
The `coder` CLI binary will now be available at `$GOPATH/bin/coder`
### Development