Skip to content

Commit

Permalink
refactor: Add install script for coder CLI (#243)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bryphe-coder committed Feb 11, 2022
1 parent a82fb8f commit c0d547b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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=. \
Expand Down
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand All @@ -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

Expand Down

0 comments on commit c0d547b

Please sign in to comment.