Merge pull request #23 from seeker89/docs-build

Add docs about using the multi-stage Dockerfile
This commit is contained in:
Mikolaj Pawlikowski
2018-12-19 12:52:48 +00:00
committed by GitHub
4 changed files with 35 additions and 3 deletions

View File

@@ -1,7 +1,15 @@
language: go
services:
- docker
go:
- "1.10.x"
- master
script: go get -u github.com/golang/dep/cmd/dep && make vendor && make
script:
- docker --version
- go get -u github.com/golang/dep/cmd/dep && make vendor && make && make build
- docker images
- make build-multistage
- docker images

View File

@@ -22,8 +22,11 @@ swagger:
swagger generate server -t pkg -f ./swagger.yml --exclude-main -A goldpinger && \
swagger generate client -t pkg -f ./swagger.yml -A goldpinger
build-multistage:
sudo docker build -t $(tag) -f ./Dockerfile .
build: bin/$(bin)
sudo docker build -t $(tag) -f ./build/Dockerfile .
sudo docker build -t $(tag) -f ./build/Dockerfile-simple .
tag:
sudo docker tag $(tag) $(namespace)$(tag)

View File

@@ -13,6 +13,8 @@ Oh, and it gives you the graph below for your cluster. Check out the [video expl
- [Rationale](#rationale)
- [Quick start](#quick-start)
- [Building](#building)
- [Compiling using a multi-stage Dockerfile](#compiling-using-a-multi-stage-dockerfile)
- [Compiling locally](#compiling-locally)
- [Installation](#installation)
- [Authentication with Kubernetes API](#authentication-with-kubernetes-api)
- [Example YAML](#example-yaml)
@@ -46,9 +48,28 @@ Note, that in order to guarantee correct versions of dependencies, the project [
## Building
The repo comes with two ways of building a `docker` image: compliling locally, and compliling using a multi-stage `Dockerfile` image.
### Compiling using a multi-stage Dockerfile
You will need `docker` version 17.05+ installed to support multi-stage builds.
```sh
# step 1: launch the build
make build-multistage
# step 2: push the image somewhere
namespace="docker.io/myhandle/" make tag
namespace="docker.io/myhandle/" make push
```
This was contributed via [@michiel](https://github.com/michiel) - kudos !
### Compiling locally
In order to build `Goldpinger`, you are going to need `go` version 1.10+, `dep`, and `docker`.
Building from source code consists of compiling the binary and building a [Docker image](./build/Dockerfile):
Building from source code consists of compiling the binary and building a [Docker image](./build/Dockerfile-simple):
```sh
# step 0: check out the code into your $GOPATH