mirror of
https://github.com/micromdm/micromdm/
synced 2026-08-12 13:25:38 +08:00
add more verbose build instructions
This commit is contained in:
54
README.md
54
README.md
@@ -41,13 +41,59 @@ If a device has an assigned workflow, `micromdm` will configure the device accor
|
||||
If you're familiar with Munki's [manifest](https://github.com/munki/munki/wiki/Manifests) feature, workflows work in a similar way.
|
||||
|
||||
# Build instructions
|
||||
To build the project from source you will need the [`go`](https://golang.org/dl/) and [`glide`](https://github.com/Masterminds/glide) tools, with a valid `GOPATH`.
|
||||
If you're new to Go see [Writing, building, installing, and testing Go code](https://www.youtube.com/watch?v=XCsL89YtqCs) and [Resources for new Go programmers](http://dave.cheney.net/resources-for-new-go-programmers) to get started.
|
||||
|
||||
* simply run `make` to install a new build.
|
||||
## If you know Go
|
||||
|
||||
1. `go get githbu.com/micromdm/micromdm`
|
||||
2. `cd $GOPATH/src/github.com/micromdm/micromdm`
|
||||
3. `glide install` install the necessary dependencies into /vendor folder
|
||||
4. `go build` or `go install`
|
||||
|
||||
## If you're new to Go
|
||||
Go is a bit different from other languages in it's requirements for how it expects it's programmers to organize Go code on a system.
|
||||
First, Go expects you to choose a folder, called a workspace(you can name it anything you'd like). The path to this folder must always be set in an environment variable - `GOPATH`(example: `GOPATH=/Users/groob/code/go`)
|
||||
Your `GOPATH` must have thee subfolders - `bin`, `pkg` and `src`, and any code you create must live inside the `src` folder. It's also helpful to add `$GOPATH/bin` to your environment's `PATH` as that is where `go install` will place go binaries that you build.
|
||||
|
||||
A few helpful resources for getting started with Go.
|
||||
|
||||
* [Writing, building, installing, and testing Go code](https://www.youtube.com/watch?v=XCsL89YtqCs)
|
||||
* [Resources for new Go programmers](http://dave.cheney.net/resources-for-new-go-programmers)
|
||||
* [How I start](https://howistart.org/posts/go/1)
|
||||
* [How to write Go code](https://golang.org/doc/code.html)
|
||||
* [GOPATH - go wiki page](https://github.com/golang/go/wiki/GOPATH)
|
||||
|
||||
To build MicroMDM you will need to install:
|
||||
1. [`go`](https://golang.org/dl/) and
|
||||
2. [`glide`](https://github.com/Masterminds/glide)
|
||||
3. Set the `GOPATH` as explained above.
|
||||
4. `mkdir -p $GOPATH/src/github.com/micromdm`
|
||||
5. `git clone` the project into the above folder. The repo must always be in the folder `$GOPATH/src/github.com/micromdm/micromdm` even if you forked the project. Add a git remote to your fork.
|
||||
6. `glide install` The glide command will download and install all necessary dependencies for the project to compile.
|
||||
7. `go build` or `go install`
|
||||
8. File an issue or a pull request if the instructions were unclear.
|
||||
|
||||
|
||||
## Makefile
|
||||
The project has a Makefile and will build the project for you assuming you have `GOPATH` set correctly.
|
||||
* run `make` to create a new build.
|
||||
* `make deps` will install the necessary dependencies. after that you can use `go build`, `go test` etc.
|
||||
* run `make docker` to build a docker container from the local source.
|
||||
|
||||
If you want to run locally for testing/development, an easy way to run postgres and redis is by using `docker-compose`
|
||||
## Docker container for Redis and PostgreSQL
|
||||
If you want to run locally for testing/development, an easy way to run PostgreSQL and Redis is by using `docker-compose`
|
||||
`docker-compose -f compose-pg.yml up`
|
||||
|
||||
## Dockerfiles for development and release.
|
||||
* `Dockerfile` will build the latest release(by downloading the binaries.
|
||||
This is equivalent to `docker pull micromdm/micromdm:latest`
|
||||
|
||||
* `Dockerfile.dev` builds the latest version from the local source.
|
||||
`docker build -f Dockerfile.dev -t micromdm .`
|
||||
|
||||
`docker pull micromdm/micromdm:dev` to get the latest version built from master.
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user