Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow to build on nonlinux & non amd64 #354

Merged
merged 1 commit into from
May 2, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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