Skip to content
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
12 changes: 8 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ GO_LINT := golint -set_exit_status
GO_FMT := gofmt
GO_VET := $(GO_CMD) vet

GO_BUILD_FLAGS ?=

GO_MODULES := $(shell $(GO_CMD) list ./...)

GOLANG_CILINT := golangci-lint
Expand Down Expand Up @@ -69,6 +71,8 @@ allclean: clean clean-cache

test: test-gopkgs

FORCE:

#
# build targets
#
Expand Down Expand Up @@ -98,14 +102,14 @@ clean-cache:
# plugins build targets
#

$(BIN_PATH)/%: plugins/%/*
$(BIN_PATH)/% build/bin/%: FORCE
$(Q)echo "Building $@..."; \
cd $(dir $<) && $(GO_BUILD) -o $@ .
$(GO_BUILD) -C plugins/$* -o $(abspath $@) $(GO_BUILD_FLAGS) .

$(BIN_PATH)/wasm: plugins/wasm/
$(BIN_PATH)/wasm build/bin/wasm: FORCE
$(Q)echo "Building $@..."; \
mkdir -p $(BIN_PATH) && \
cd $(dir $<) && GOOS=wasip1 GOARCH=wasm $(GO_BUILD) -o $@ -buildmode=c-shared .
GOOS=wasip1 GOARCH=wasm $(GO_BUILD) -C plugins/wasm -o $(abspath $@) $(GO_BUILD_FLAGS) -buildmode=c-shared .

#
# test targets
Expand Down
5 changes: 3 additions & 2 deletions plugins/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ RUN --mount=type=cache,target=/go/pkg/mod/ go mod download
COPY . .

RUN --mount=type=cache,target=/go/pkg/mod/ \
make /go/src/build/bin/${PLUGIN} \
GO_BUILD="CGO_ENABLED=0 go build -ldflags '-extldflags=-static'"
make build/bin/${PLUGIN} \
GO_BUILD="CGO_ENABLED=0 go build" \
GO_BUILD_FLAGS="-ldflags '-extldflags=-static'"

# Construct final image
FROM scratch
Expand Down
Loading