Skip to content

Commit

Permalink
Add cross-compiling
Browse files Browse the repository at this point in the history
- Update to Golang 1.6.2
- Use gox for xcompile
  • Loading branch information
karlkfi committed May 19, 2016
1 parent 4ced8f4 commit 47bb36f
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@

# Build Artifacts
/probe
/pkg
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ build:
@echo "--> Building probe"
@godep go build -o probe

build-cross:
@echo "--> Building probe"
gox -osarch="darwin/amd64" -osarch="linux/amd64" -output "pkg/{{.OS}}_{{.Arch}}/{{.Dir}}"

test_banner:
@echo "--> Testing probe"

Expand Down Expand Up @@ -62,3 +66,7 @@ builder:
build-docker:
@echo "--> Building probe (in karlkfi/probe-builder:${BUILDER_VERSION})"
@docker run -v "$(shell pwd):/go/src/github.com/karlkfi/probe" karlkfi/probe-builder:${BUILDER_VERSION}

build-docker-cross:
@echo "--> Building probe (in karlkfi/probe-builder:${BUILDER_VERSION}) for all platforms"
@docker run -v "$(shell pwd):/go/src/github.com/karlkfi/probe" karlkfi/probe-builder:${BUILDER_VERSION} make restoredeps test build-cross
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ Build the linux binary in docker (Requires [Docker](https://docs.docker.com/inst
make build-docker
```

Build the Linux and Mac binaries in docker (Requires [Docker](https://docs.docker.com/installation/)):

```
make build-docker-cross
```

Build the docker builder (Requires [Docker](https://docs.docker.com/installation/)):

```
Expand All @@ -141,8 +147,7 @@ make builder
### TODO

1. Add SSL certificate validation options (currently ignores cert validity).
2. Upload cross-platform pre-compiled binaries
3. Add configurable DNS caching
2. Add configurable DNS caching

### License

Expand Down
5 changes: 3 additions & 2 deletions builder/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.4.2-wheezy
FROM golang:1.6.2-wheezy
MAINTAINER Karl Isenberg <[email protected]>

RUN echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/sources.list && \
Expand All @@ -10,7 +10,8 @@ RUN echo "deb-src http://httpredir.debian.org/debian wheezy main" >> /etc/apt/so
apt-get -y clean

RUN go get github.com/tools/godep
RUN go get golang.org/x/tools/cmd/vet
RUN go get github.com/mitchellh/gox
ENV GO15VENDOREXPERIMENT 0

VOLUME ${GOPATH}/src/github.com/karlkfi/probe

Expand Down

0 comments on commit 47bb36f

Please sign in to comment.