Skip to content

Commit

Permalink
Merge pull request #354 from usefathom/build-arch-independet
Browse files Browse the repository at this point in the history
Allow to build on nonlinux & non amd64
  • Loading branch information
LKaemmerling authored May 2, 2022
2 parents 4d1bc96 + 6bcacea commit 3ef9edc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 3ef9edc

Please sign in to comment.