From be17cd2447a29b4911ea8113f692f4f09e676ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ljubi=C5=A1a=20Ga=C4=8Devi=C4=87?= <35105035+gacevicljubisa@users.noreply.github.com> Date: Thu, 7 Nov 2024 15:21:42 +0100 Subject: [PATCH] chore: add docker-build target to Makefile with support for configurable build flags (#4893) --- .gitignore | 1 + Dockerfile | 2 +- Dockerfile.dev | 22 ++++++++++++++++++++++ Dockerfile.goreleaser | 2 +- Dockerfile.scratch | 2 +- Makefile | 10 ++++++++++ README.md | 7 +++---- 7 files changed, 39 insertions(+), 7 deletions(-) create mode 100644 Dockerfile.dev diff --git a/.gitignore b/.gitignore index 13d4502b5ba..b7b0629ab25 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,7 @@ /dist /.idea /.vscode +/tmp # Compiled Object files, Static and Dynamic libs (Shared Objects) *.o diff --git a/Dockerfile b/Dockerfile index c957601a9ea..0989384d42c 100644 --- a/Dockerfile +++ b/Dockerfile @@ -10,7 +10,7 @@ RUN make binary FROM debian:12.7-slim -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates; \ diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 00000000000..48bb86c6af4 --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,22 @@ +FROM debian:12.7-slim + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && apt-get install -y --no-install-recommends \ + ca-certificates; \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/*; \ + groupadd -r bee --gid 999; \ + useradd -r -g bee --uid 999 --no-log-init -m bee; + +# make sure mounted volumes have correct permissions +RUN mkdir -p /home/bee/.bee && chown 999:999 /home/bee/.bee + +COPY ./tmp/bee /usr/local/bin/bee + +EXPOSE 1633 1634 +USER bee +WORKDIR /home/bee +VOLUME /home/bee/.bee + +ENTRYPOINT ["bee"] diff --git a/Dockerfile.goreleaser b/Dockerfile.goreleaser index 943e63eaeee..0ba724a0df7 100644 --- a/Dockerfile.goreleaser +++ b/Dockerfile.goreleaser @@ -1,6 +1,6 @@ FROM debian:12.7-slim -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates; \ diff --git a/Dockerfile.scratch b/Dockerfile.scratch index c0e13abe1e6..182a92aa284 100644 --- a/Dockerfile.scratch +++ b/Dockerfile.scratch @@ -1,6 +1,6 @@ FROM debian:12.7-slim -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive RUN apt-get update && apt-get install -y --no-install-recommends \ ca-certificates; \ diff --git a/Makefile b/Makefile index 90e2a6c781b..4e5fcefef98 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,7 @@ BEELOCAL_BRANCH ?= main BEEKEEPER_BRANCH ?= master REACHABILITY_OVERRIDE_PUBLIC ?= false BATCHFACTOR_OVERRIDE_PUBLIC ?= 5 +BEE_IMAGE ?= ethersphere/bee:latest BEE_API_VERSION ?= "$(shell grep '^ version:' openapi/Swarm.yaml | awk '{print $$2}')" @@ -141,6 +142,15 @@ build: export CGO_ENABLED=0 build: $(GO) build -trimpath -ldflags "$(LDFLAGS)" ./... +.PHONY: docker-build +docker-build: binary + @echo "Build flags: $(LDFLAGS)" + mkdir -p ./tmp + cp ./dist/bee ./tmp/bee + docker build -f Dockerfile.dev -t $(BEE_IMAGE) . --no-cache + rm -rf ./tmp + @echo "Docker image: $(BEE_IMAGE)" + .PHONY: githooks githooks: ln -f -s ../../.githooks/pre-push.bash .git/hooks/pre-push diff --git a/README.md b/README.md index c310e4fea89..ad6caf49529 100644 --- a/README.md +++ b/README.md @@ -9,8 +9,8 @@ ![GitHub all releases](https://img.shields.io/github/downloads/ethersphere/bee/total) ![GitHub](https://img.shields.io/github/license/ethersphere/bee) - ## DISCLAIMER + This software is provided to you "as is", use at your own risk and without warranties of any kind. It is your responsibility to read and understand how Swarm works and the implications of running this software. The usage of Bee involves various risks, including, but not limited to: @@ -18,14 +18,13 @@ damage to hardware or loss of funds associated with the Ethereum account connect No developers or entity involved will be liable for any claims and damages associated with your use, inability to use, or your interaction with other nodes or the software. -Our documentation is hosted at https://docs.ethswarm.org. +Our documentation is hosted at . ## Versioning There are two versioning schemes used in Bee that you should be aware of. The main Bee version does **NOT** follow strict Semantic Versioning. Bee hosts different peer-to-peer wire protocol implementations and individual protocol breaking changes would necessitate a bump in the major part of the version. Breaking changes are expected with bumps of the minor version component. New (backward-compatible) features and bug fixes are expected with a bump of the patch component. Major version bumps are reserved for significant changes in Swarm's incentive structure. - The second is the Bee's API version (denoted in our [Bee](https://github.com/ethersphere/bee/blob/master/openapi/Swarm.yaml) OpenAPI specifications). This version **follows** Semantic Versioning and hence you should follow these for breaking changes. @@ -38,8 +37,8 @@ Please read the [coding guidelines](CODING.md) and [style guide](CODINGSTYLE.md) [Install instructions](https://docs.ethswarm.org/docs/installation/quick-start) ## Get in touch -[Only official website](https://www.ethswarm.org) +[Only official website](https://www.ethswarm.org) ## License