From 018b065ef1a58516b89b441be3c4ba37560880ad Mon Sep 17 00:00:00 2001 From: Alex Ellis <alexellis2@gmail.com> Date: Tue, 24 Jan 2017 19:38:06 +0000 Subject: [PATCH] Initial work for ARMHF --- docker-compose-armhf.yml | 30 ++++++++++++++++++++++++++++++ gateway/Dockerfile.build.armhf | 16 ++++++++++++++++ gateway/armhf.build.sh | 13 +++++++++++++ watchdog/Dockerfile.armhf | 7 +++++++ watchdog/armhf.build.sh | 13 +++++++++++++ watchdog/build.sh | 2 +- 6 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 docker-compose-armhf.yml create mode 100644 gateway/Dockerfile.build.armhf create mode 100755 gateway/armhf.build.sh create mode 100644 watchdog/Dockerfile.armhf create mode 100755 watchdog/armhf.build.sh diff --git a/docker-compose-armhf.yml b/docker-compose-armhf.yml new file mode 100644 index 00000000..b2a96f6a --- /dev/null +++ b/docker-compose-armhf.yml @@ -0,0 +1,30 @@ +version: "3" +services: + gateway: + volumes: + - "/var/run/docker.sock:/var/run/docker.sock" + ports: + - 8080:8080 + image: alexellis2/faas-gateway:latest-armhf + networks: + - functions + + prometheus: + image: alexellis2/prometheus-armhf:latest + volumes: + - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml + command: "-config.file=/etc/prometheus/prometheus.yml -storage.local.path=/prometheus -storage.local.memory-chunks=10000" + ports: + - 9090:9090 + depends_on: + - gateway + environment: + no_proxy: "gateway" + networks: + - functions + +networks: + functions: + driver: overlay + # Docker does not support this option yet - maybe create outside of the stack and reference as "external"? + #attachable: true diff --git a/gateway/Dockerfile.build.armhf b/gateway/Dockerfile.build.armhf new file mode 100644 index 00000000..3a891498 --- /dev/null +++ b/gateway/Dockerfile.build.armhf @@ -0,0 +1,16 @@ +FROM alexellis2/go-armhf:1.7.4 + +RUN go get -d github.com/docker/docker/api/types \ + && go get -d github.com/docker/docker/api/types/filters \ + && go get -d github.com/docker/docker/api/types/swarm \ + && go get -d github.com/docker/docker/client \ + && go get github.com/gorilla/mux \ + && go get github.com/prometheus/client_golang/prometheus + +WORKDIR /go/src/github.com/alexellis/faas/gateway + +COPY metrics metrics +COPY server.go . + +RUN find /go/src/github.com/alexellis/faas/gateway/ +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . diff --git a/gateway/armhf.build.sh b/gateway/armhf.build.sh new file mode 100755 index 00000000..1185c10b --- /dev/null +++ b/gateway/armhf.build.sh @@ -0,0 +1,13 @@ +#!/bin/sh +echo Building alexellis2/faas-gateway:build-armhf + +docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \ + -t alexellis2/faas-gateway:build-armhf . -f Dockerfile.build.armhf + +docker create --name gateway_extract alexellis2/faas-gateway:build-armhf echo +docker cp gateway_extract:/go/src/github.com/alexellis/faas/gateway/app ./gateway +docker rm -f gateway_extract + +echo Building alexellis2/faas-gateway:latest-armhf + +docker build -t alexellis2/faas-gateway:latest-armhf . diff --git a/watchdog/Dockerfile.armhf b/watchdog/Dockerfile.armhf new file mode 100644 index 00000000..9b3478db --- /dev/null +++ b/watchdog/Dockerfile.armhf @@ -0,0 +1,7 @@ +FROM alexellis2/go-armhf:1.7.4 + +RUN mkdir -p /go/src/app +COPY main.go /go/src/app +WORKDIR /go/src/app +RUN go get -d -v +RUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app . diff --git a/watchdog/armhf.build.sh b/watchdog/armhf.build.sh new file mode 100755 index 00000000..f1fd28cf --- /dev/null +++ b/watchdog/armhf.build.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +# Below makes use of "builder pattern" so that binary is extracted separate +# from the golang runtime/SDK + +echo Building alexellis2/faas-watchdog:build-armhf + +docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \ + -t alexellis2/faas-watchdog:build-armhf . -f Dockerfile.armhf +docker create --name buildoutput alexellis2/faas-watchdog:build-armhf echo +docker cp buildoutput:/go/src/app/app ./fwatchdog +docker rm buildoutput + diff --git a/watchdog/build.sh b/watchdog/build.sh index c48da1f7..e0dab608 100755 --- a/watchdog/build.sh +++ b/watchdog/build.sh @@ -5,6 +5,6 @@ docker build --build-arg https_proxy=$https_proxy --build-arg http_proxy=$http_proxy \ -t alexellis2/faas-watchdog:build . -docker create --name buildoutput alexellis2/faas-watchdog:build +docker create --name buildoutput alexellis2/faas-watchdog:build echo docker cp buildoutput:/go/src/app/app ./fwatchdog docker rm buildoutput -- GitLab