From c0d547b6a20f6e448e73d74fb2bc52c287764c34 Mon Sep 17 00:00:00 2001 From: Bryan Date: Thu, 10 Feb 2022 20:32:00 -0800 Subject: [PATCH] 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. --- Makefile | 8 ++++++++ README.md | 10 ++++++++++ 2 files changed, 18 insertions(+) diff --git a/Makefile b/Makefile index e14562b46e..388eb44b6f 100644 --- a/Makefile +++ b/Makefile @@ -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=. \ diff --git a/README.md b/README.md index 9cd8bc0950..41fd90fbad 100644 --- a/README.md +++ b/README.md @@ -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