Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c0d547b

Browse files
authored
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.
1 parent a82fb8f commit c0d547b

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
INSTALL_DIR=$(shell go env GOPATH)/bin
2+
13
bin/coder:
24
mkdir -p bin
35
go build -o bin/coder cmd/coder/main.go
@@ -51,6 +53,12 @@ fmt: fmt/prettier fmt/sql
5153
gen: database/generate peerbroker/proto provisionersdk/proto provisionerd/proto
5254
.PHONY: gen
5355

56+
install:
57+
@echo "--- Copying from bin to $(INSTALL_DIR)"
58+
cp -r ./bin $(INSTALL_DIR)
59+
@echo "-- CLI available at $(shell ls $(INSTALL_DIR)/coder*)"
60+
.PHONY: install
61+
5462
peerbroker/proto: peerbroker/proto/peerbroker.proto
5563
protoc \
5664
--go_out=. \

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,13 @@ This repository contains source code for Coder V2. Additional documentation:
1515

1616
## Development
1717

18+
### Pre-requisites
19+
20+
- `git`
21+
- `go` version 1.17, with the `GOPATH` environment variable set
22+
- `node`
23+
- `yarn`
24+
1825
### Cloning
1926

2027
- `git clone https://github.com/coder/coder`
@@ -23,6 +30,9 @@ This repository contains source code for Coder V2. Additional documentation:
2330
### Building
2431

2532
- `make build`
33+
- `make install`
34+
35+
The `coder` CLI binary will now be available at `$GOPATH/bin/coder`
2636

2737
### Development
2838

0 commit comments

Comments
 (0)