From 6bcaceaba5a799881ab1ea94d0a508546337895c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20K=C3=A4mmerling?= Date: Mon, 2 May 2022 23:12:29 +0200 Subject: [PATCH] Allow to build on nonlinux & non amd64 Superseeds !203 --- Dockerfile | 4 +++- Makefile | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 21b5774..7e68573 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,9 @@ RUN go install github.com/gobuffalo/packr/packr@latest 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 +ARG GOOS=linux +RUN make ARCH=${GOARCH} OS=${GOOS} docker FROM alpine:latest EXPOSE 8080 diff --git a/Makefile b/Makefile index 566899b..830ba6b 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,8 @@ 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 +OS := linux .PHONY: all all: build @@ -17,7 +19,7 @@ $(EXECUTABLE): $(GO_SOURCES) assets/build .PHONY: docker docker: $(GO_SOURCES) $(GOPATH)/bin/packr - GOOS=linux GOARCH=amd64 $(GOPATH)/bin/packr build -v -ldflags '-w $(LDFLAGS)' -o $(EXECUTABLE) $(MAIN_PKG) + GOOS=S(OS) GOARCH=$(ARCH) $(GOPATH)/bin/packr build -v -ldflags '-w $(LDFLAGS)' -o $(EXECUTABLE) $(MAIN_PKG) $(GOPATH)/bin/packr: GOBIN=$(GOPATH)/bin go install github.com/gobuffalo/packr/packr@latest