Skip to content

Commit

Permalink
chore: build dev docker image using makefile
Browse files Browse the repository at this point in the history
  • Loading branch information
gacevicljubisa committed Nov 6, 2024
1 parent 44d5fbe commit 7c30e31
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/beekeeper.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ env:
RUN_TYPE: "PR RUN"
SETUP_CONTRACT_IMAGE: "ethersphere/bee-localchain"
SETUP_CONTRACT_IMAGE_TAG: "0.9.2-rc6"
BEELOCAL_BRANCH: "main"
BEELOCAL_BRANCH: "dev-docker-build"
BEEKEEPER_BRANCH: "master"
BEEKEEPER_METRICS_ENABLED: false
REACHABILITY_OVERRIDE_PUBLIC: true
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/dist
/.idea
/.vscode
/tmp

# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
Expand Down
18 changes: 1 addition & 17 deletions Dockerfile.dev
Original file line number Diff line number Diff line change
@@ -1,19 +1,3 @@
FROM golang:1.23 AS build

ARG REACHABILITY_OVERRIDE_PUBLIC=false
ARG BATCHFACTOR_OVERRIDE_PUBLIC=5

WORKDIR /src
# enable modules caching in separate layer
COPY go.mod go.sum ./
RUN go mod download
COPY . ./

# Run make binary with specified arguments
RUN make binary \
REACHABILITY_OVERRIDE_PUBLIC=$REACHABILITY_OVERRIDE_PUBLIC \
BATCHFACTOR_OVERRIDE_PUBLIC=$BATCHFACTOR_OVERRIDE_PUBLIC

FROM debian:12.7-slim

ENV DEBIAN_FRONTEND=noninteractive
Expand All @@ -28,7 +12,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
# make sure mounted volumes have correct permissions
RUN mkdir -p /home/bee/.bee && chown 999:999 /home/bee/.bee

COPY --from=build /src/dist/bee /usr/local/bin/bee
COPY ./tmp/bee /usr/local/bin/bee

EXPOSE 1633 1634
USER bee
Expand Down
13 changes: 7 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,13 @@ build:
$(GO) build -trimpath -ldflags "$(LDFLAGS)" ./...

.PHONY: docker-build
docker-build:
docker build \
--build-arg REACHABILITY_OVERRIDE_PUBLIC=$(REACHABILITY_OVERRIDE_PUBLIC) \
--build-arg BATCHFACTOR_OVERRIDE_PUBLIC=$(BATCHFACTOR_OVERRIDE_PUBLIC) \
-f Dockerfile.dev \
-t $(IMAGE) . --no-cache
docker-build: binary
@echo "Build flags: $(LDFLAGS)"
mkdir -p ./tmp
cp ./dist/bee ./tmp/bee
docker build -f Dockerfile.dev -t $(IMAGE) . --no-cache
rm -rf ./tmp
@echo "Docker image: $(IMAGE)"

.PHONY: githooks
githooks:
Expand Down

0 comments on commit 7c30e31

Please sign in to comment.