File tree Expand file tree Collapse file tree 2 files changed +25
-8
lines changed
Expand file tree Collapse file tree 2 files changed +25
-8
lines changed Original file line number Diff line number Diff line change 1+ FROM golang:1.23 AS build
2+
3+ ARG REACHABILITY_OVERRIDE_PUBLIC=false
4+ ARG BATCHFACTOR_OVERRIDE_PUBLIC=5
5+
6+ WORKDIR /src
7+ # enable modules caching in separate layer
8+ COPY go.mod go.sum ./
9+ RUN go mod download
10+ COPY . ./
11+
12+ RUN make binary \
13+ REACHABILITY_OVERRIDE_PUBLIC=${REACHABILITY_OVERRIDE_PUBLIC} \
14+ BATCHFACTOR_OVERRIDE_PUBLIC=${BATCHFACTOR_OVERRIDE_PUBLIC}
15+
116FROM debian:12.7-slim
217
318ENV DEBIAN_FRONTEND=noninteractive
419
520RUN apt-get update && apt-get install -y --no-install-recommends \
6- ca-certificates; \
21+ ca-certificates; \
722 apt-get clean; \
823 rm -rf /var/lib/apt/lists/*; \
924 groupadd -r bee --gid 999; \
@@ -12,7 +27,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1227# make sure mounted volumes have correct permissions
1328RUN mkdir -p /home/bee/.bee && chown 999:999 /home/bee/.bee
1429
15- COPY ./tmp /bee /usr/local/bin/bee
30+ COPY --from=build /src/dist /bee /usr/local/bin/bee
1631
1732EXPOSE 1633 1634
1833USER bee
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ BEEKEEPER_BRANCH ?= master
1212REACHABILITY_OVERRIDE_PUBLIC ?= false
1313BATCHFACTOR_OVERRIDE_PUBLIC ?= 5
1414BEE_IMAGE ?= ethersphere/bee:latest
15+ PLATFORM ?= linux/amd64
1516
1617BEE_API_VERSION ?= "$(shell grep '^ version:' openapi/Swarm.yaml | awk '{print $$2}') "
1718
@@ -142,13 +143,14 @@ build: export CGO_ENABLED=0
142143build :
143144 $(GO ) build -trimpath -ldflags " $( LDFLAGS) " ./...
144145
146+ # example: make docker-build PLATFORM=linux/amd64 BEE_IMAGE=ethersphere/bee:latest REACHABILITY_OVERRIDE_PUBLIC=false BATCHFACTOR_OVERRIDE_PUBLIC=5
145147.PHONY : docker-build
146- docker-build : binary
147- @echo " Build flags: $( LDFLAGS ) "
148- mkdir -p ./tmp
149- cp ./dist/bee ./tmp/bee
150- docker build -f Dockerfile.dev -t $( BEE_IMAGE ) . --no-cache
151- rm -rf ./tmp
148+ docker-build :
149+ docker build -f Dockerfile.dev \
150+ --platform $( PLATFORM ) \
151+ -t $( BEE_IMAGE ) . \
152+ -- build-arg REACHABILITY_OVERRIDE_PUBLIC= $( REACHABILITY_OVERRIDE_PUBLIC ) \
153+ --build-arg BATCHFACTOR_OVERRIDE_PUBLIC= $( BATCHFACTOR_OVERRIDE_PUBLIC )
152154 @echo " Docker image: $( BEE_IMAGE) "
153155
154156.PHONY : githooks
You can’t perform that action at this time.
0 commit comments