From aee30a4209a0b7fc3790af2cd6828edc1e960351 Mon Sep 17 00:00:00 2001 From: marpio Date: Tue, 18 Dec 2018 14:56:31 +0100 Subject: [PATCH] make target and docs (#1002) * make target and docs * fix grammar --- Makefile | 5 ++++ docs/content/install/_index.md | 3 +- docs/content/install/build-from-source.md | 34 +++++++++++++++++++++++ 3 files changed, 40 insertions(+), 2 deletions(-) create mode 100644 docs/content/install/build-from-source.md diff --git a/Makefile b/Makefile index b4370304..885f0750 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,12 @@ +VERSION = "unset" +DATE=$(shell date -u +%Y-%m-%d-%H:%M:%S-%Z) .PHONY: build build: cd cmd/proxy && buffalo build +build-ver: + GO111MODULE=on CGO_ENABLED=0 go build -mod=vendor -ldflags "-X github.com/gomods/athens/pkg/build.version=$(VERSION) -X github.com/gomods/athens/pkg/build.buildDate=$(DATE)" -o athens ./cmd/proxy + .PHONY: run run: build ./athens diff --git a/docs/content/install/_index.md b/docs/content/install/_index.md index dc492e9f..0c63a024 100644 --- a/docs/content/install/_index.md +++ b/docs/content/install/_index.md @@ -26,7 +26,6 @@ We strongly recommend using a tagged release, e.g. `gomods/athens:v0.2.0`, inste To make sure it's easy to install, we try to provide as many ways as possible to install and run Athens: -- It's written in Go, so we provide a self-contained binary. You can configure and run the binary on your machine(s) - - Instructions on how to run directly from the binary are coming soon +- It's written in Go, so you can easily build it yourself on almost any platform. You can also build the binary providing your own version and build time. See [here](./build-from-source) - We provide a [Docker image](https://hub.docker.com/r/gomods/athens/) and [instructions on how to run it](./shared-team-instance) - We provide [Kubernetes](https://kubernetes.io) [Helm Charts](https://helm.sh) with [instructions on how to run Athens on Kubernetes](./install-on-kubernetes) diff --git a/docs/content/install/build-from-source.md b/docs/content/install/build-from-source.md new file mode 100644 index 00000000..2a9b76de --- /dev/null +++ b/docs/content/install/build-from-source.md @@ -0,0 +1,34 @@ +--- +title: Building a versioned Athens binary from source +description: Building a versioned Athens binary from source +weight: 1 +--- +You can do that easily with just few commands: + +**Bash** +```bash +git clone https://github.com/gomods/athens +cd athens +make build-ver VERSION="0.2.0" +``` + +**PowerShell** +```PowerShell +git clone https://github.com/gomods/athens +cd athens +$env:GO111MODULE="on" +$version = "0.2.0" +$date = (Get-Date).ToUniversalTime() +go build -mod=vendor -ldflags "-X github.com/gomods/athens/pkg/build.version=$version -X github.com/gomods/athens/pkg/build.buildDate=$date" -o athens ./cmd/proxy +``` + +This will give you a binary named `athens`. You can print the version and time information by running: +```console + ./athens -version +``` +which should return something like: +```console +Build Details: + Version: 0.2.0 + Date: 2018-12-13-20:51:06-UTC +```