From 6c4f361c8989dad3e6a76321dcde7f3ace1588d4 Mon Sep 17 00:00:00 2001 From: Ljubisa Date: Tue, 5 Nov 2024 13:39:22 +0100 Subject: [PATCH] chore: add new Dockerfile.dev --- Dockerfile | 10 ++-------- Dockerfile.dev | 38 ++++++++++++++++++++++++++++++++++++++ Makefile | 1 + 3 files changed, 41 insertions(+), 8 deletions(-) create mode 100644 Dockerfile.dev diff --git a/Dockerfile b/Dockerfile index e9eb57ffdae..e3d581e1d6f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,18 +1,12 @@ FROM golang:1.22 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 +RUN make binary FROM debian:12.4-slim @@ -35,4 +29,4 @@ USER bee WORKDIR /home/bee VOLUME /home/bee/.bee -ENTRYPOINT ["bee"] +ENTRYPOINT ["bee"] \ No newline at end of file diff --git a/Dockerfile.dev b/Dockerfile.dev new file mode 100644 index 00000000000..e9eb57ffdae --- /dev/null +++ b/Dockerfile.dev @@ -0,0 +1,38 @@ +FROM golang:1.22 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.4-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 --from=build /src/dist/bee /usr/local/bin/bee + +EXPOSE 1633 1634 +USER bee +WORKDIR /home/bee +VOLUME /home/bee/.bee + +ENTRYPOINT ["bee"] diff --git a/Makefile b/Makefile index c0f7a3ab8c4..20408d4444a 100644 --- a/Makefile +++ b/Makefile @@ -147,6 +147,7 @@ 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 .PHONY: githooks