From 73901bada7761740b0a5f5200cda9cd1fed90b0a Mon Sep 17 00:00:00 2001 From: Ljubisa Date: Tue, 5 Nov 2024 09:51:48 +0100 Subject: [PATCH] chore: add docker-build target and enable usage of .env in makefile --- .gitignore | 1 + Dockerfile | 4 +--- Makefile | 10 ++++++++++ 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 13d4502b5ba..8752271745e 100644 --- a/.gitignore +++ b/.gitignore @@ -28,3 +28,4 @@ _testmain.go *.prof .DS_Store +.env diff --git a/Dockerfile b/Dockerfile index b1bd831f118..af87f6d4824 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,9 +6,7 @@ COPY go.mod go.sum ./ RUN go mod download COPY . ./ -ARG REACHABILITY_OVERRIDE_PUBLIC=false - -RUN make binary REACHABILITY_OVERRIDE_PUBLIC=${REACHABILITY_OVERRIDE_PUBLIC} +RUN make binary FROM debian:12.4-slim diff --git a/Makefile b/Makefile index 2c654ea5d7d..ffdfda8360e 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,8 @@ +ifneq (,$(wildcard ./.env)) + include .env + export +endif + GO ?= go GOBIN ?= $$($(GO) env GOPATH)/bin GOLANGCI_LINT ?= $(GOBIN)/golangci-lint @@ -11,6 +16,7 @@ BEELOCAL_BRANCH ?= main BEEKEEPER_BRANCH ?= master REACHABILITY_OVERRIDE_PUBLIC ?= false BATCHFACTOR_OVERRIDE_PUBLIC ?= 5 +IMAGE ?= ethersphere/bee:latest BEE_API_VERSION ?= "$(shell grep '^ version:' openapi/Swarm.yaml | awk '{print $$2}')" @@ -141,6 +147,10 @@ build: export CGO_ENABLED=0 build: $(GO) build -trimpath -ldflags "$(LDFLAGS)" ./... +.PHONY: docker-build +docker-build: + docker build -t $(IMAGE) . --no-cache + .PHONY: githooks githooks: ln -f -s ../../.githooks/pre-push.bash .git/hooks/pre-push