Skip to content
This repository has been archived by the owner on Feb 28, 2020. It is now read-only.

Commit

Permalink
builder for swarm binary
Browse files Browse the repository at this point in the history
  • Loading branch information
alexellis committed Jan 20, 2016
1 parent b6d358c commit 776d945
Show file tree
Hide file tree
Showing 8 changed files with 61 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
@@ -1,2 +1,4 @@
images/docker-arm/docker-1.9
images/docker-arm/backup/
images/swarm-arm-builder/binary/

16 changes: 16 additions & 0 deletions images/go-arm1.5/Dockerfile
@@ -0,0 +1,16 @@
FROM armhf/ubuntu
RUN apt-get update && apt-get -qy install git nano curl wget build-essential

RUN wget \
https://github.com/hypriot/golang-armbuilds/releases/download/v1.5.2/go1.5.2.linux-armv7.tar.gz
RUN tar -xf go*.tar.gz -C /usr/local/

ENV PATH \
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin
RUN mkdir /go
ENV GOPATH /go
ENV AUTO_GOPATH 1
RUN go version
RUN AUTO_GOPATH=1 go get github.com/tools/godep

CMD ["go version"]
3 changes: 3 additions & 0 deletions images/go-arm1.5/README.md
@@ -0,0 +1,3 @@
go 1.5 for ARM, built out with the binary from @hypriot

This image can be used to build docker swarm, godep etc.
4 changes: 4 additions & 0 deletions images/go-arm1.5/build.sh
@@ -0,0 +1,4 @@
#!/bin/bash

docker build -t alexellis2/go-arm:1.5 .

15 changes: 15 additions & 0 deletions images/swarm-arm-builder/Dockerfile
@@ -0,0 +1,15 @@
FROM alexellis2/go-arm:1.5

WORKDIR $GOPATH/src/github.com/docker/
RUN git clone https://github.com/docker/swarm
WORKDIR $GOPATH/src/github.com/docker/swarm
RUN mkdir -p /usr/lib/go/pkg/linux_arm_netgo/
ENV CGO_ENABLED 0
ENV PATH \
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/go/bin:/go/bin

RUN godep go install -v -a -tags netgo -installsuffix netgo -ldflags '-extldflags "-static" -s' .
WORKDIR /root/
ADD ./export_binary.sh ./

CMD ["/go/bin/swarm", "--help"]
10 changes: 10 additions & 0 deletions images/swarm-arm-builder/README.md
@@ -0,0 +1,10 @@
Builds an ARM compatible docker swarm binary through Docker
============================================================

### Depends on alexellis2/arm-go:1.5

For the article, this is prebuilt and available in the swarm-arm folder.

If you wish to rebuild its binary from source run build.sh and then copy ./binary/swarm to ../swarm-arm/ and
rebuild the container.

7 changes: 7 additions & 0 deletions images/swarm-arm-builder/build.sh
@@ -0,0 +1,7 @@
#!/bin/bash

docker build -t alexellis2/swarm-arm-builder .
mkdir -p binary
docker run -v `pwd`/binary:/tmp/binary alexellis2/swarm-arm-builder /root/export_binary.sh

echo "An ARM compatible swarm binary will now be found in the /binary folder"
4 changes: 4 additions & 0 deletions images/swarm-arm-builder/export_binary.sh
@@ -0,0 +1,4 @@
#!/bin/bash

cp /go/bin/swarm /tmp/binary/

0 comments on commit 776d945

Please sign in to comment.