From 0ca61b5f8458781857f15213b447678b3a8dc63d Mon Sep 17 00:00:00 2001 From: KemoNine Date: Sun, 6 Jan 2019 00:07:18 +0000 Subject: [PATCH 1/2] Add arm/alternate arch support --- Dockerfile | 3 ++- Makefile | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9d3f3742..3b84a444 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,8 @@ FROM golang:latest AS binarybuilder WORKDIR /go/src/github.com/usefathom/fathom COPY . /go/src/github.com/usefathom/fathom COPY --from=assetbuilder /app/assets/build ./assets/build -RUN make docker +ARG GOARCH=amd64 +RUN make ARCH=${GOARCH} docker FROM alpine:latest EXPOSE 8080 diff --git a/Makefile b/Makefile index 1b1696ab..11b4a159 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ PACKAGES ?= $(shell go list ./... | grep -v /vendor/) ASSET_SOURCES ?= $(shell find assets/src/. -type f) GO_SOURCES ?= $(shell find . -name "*.go" -type f) GOPATH=$(shell go env GOPATH) +ARCH := amd64 .PHONY: all all: build @@ -17,7 +18,7 @@ $(EXECUTABLE): $(GO_SOURCES) assets/build .PHONY: docker docker: $(GO_SOURCES) - GOOS=linux GOARCH=amd64 $(GOPATH)/bin/packr build -v -ldflags '-w $(LDFLAGS)' -o $(EXECUTABLE) $(MAIN_PKG) + GOOS=linux GOARCH=$(ARCH) $(GOPATH)/bin/packr build -v -ldflags '-w $(LDFLAGS)' -o $(EXECUTABLE) $(MAIN_PKG) $(GOPATH)/bin/packr: GOBIN=$(GOPATH)/bin go get -u github.com/gobuffalo/packr/packr @@ -67,4 +68,4 @@ test: .PHONY: referrer-spam-blacklist referrer-spam-blacklist: wget https://raw.githubusercontent.com/matomo-org/referrer-spam-blacklist/master/spammers.txt -O pkg/aggregator/data/blacklist.txt - go-bindata -prefix "pkg/aggregator/data/" -o pkg/aggregator/bindata.go -pkg aggregator pkg/aggregator/data/ \ No newline at end of file + go-bindata -prefix "pkg/aggregator/data/" -o pkg/aggregator/bindata.go -pkg aggregator pkg/aggregator/data/ From 17ff28e71bcfe9076a538449c8fee3c63430a3dc Mon Sep 17 00:00:00 2001 From: KemoNine Date: Sun, 6 Jan 2019 00:31:30 +0000 Subject: [PATCH 2/2] Ensure packr is present in docker image used to build fathom --- Dockerfile | 1 + 1 file changed, 1 insertion(+) diff --git a/Dockerfile b/Dockerfile index 3b84a444..4893264b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ COPY assets/ ./assets/ RUN npm install && NODE_ENV=production ./node_modules/gulp/bin/gulp.js FROM golang:latest AS binarybuilder +RUN go get -u github.com/gobuffalo/packr/packr WORKDIR /go/src/github.com/usefathom/fathom COPY . /go/src/github.com/usefathom/fathom COPY --from=assetbuilder /app/assets/build ./assets/build