From 21aba7cd65b6eb969f5566012d3d3f516b4b5232 Mon Sep 17 00:00:00 2001 From: Jakub Date: Fri, 15 Oct 2021 12:47:23 +0200 Subject: [PATCH] Dockerfile: add commit, log format, and make target (#83) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also fixed `.dockerignore` file and removed unnecessary symlinking. Related to: https://github.com/status-im/infra-go-waku Signed-off-by: Jakub SokoĊ‚owski --- .dockerignore | 14 +++++++------- Dockerfile | 17 ++++++++++------- Makefile | 9 ++++++++- 3 files changed, 25 insertions(+), 15 deletions(-) diff --git a/.dockerignore b/.dockerignore index b41bfb90..c881e2e5 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,7 +1,7 @@ -/README.md -/Dockerfile -/.*ignore -/LICENSE* -/tests -/examples -/*.db +README.md +Dockerfile +.*ignore +LICENSE* +tests +examples +*.db diff --git a/Dockerfile b/Dockerfile index be2b8baa..f859732f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,24 +8,27 @@ WORKDIR /app COPY . . # Build the final node binary -RUN make -j$(nproc) $MAKE_TARGET +RUN make -j$(nproc) build # ACTUAL IMAGE ------------------------------------------------------- FROM alpine:3.12 +ARG GIT_COMMIT=unknown + LABEL maintainer="richard@status.im" LABEL source="https://github.com/status-im/go-waku" LABEL description="go-waku: Waku V2 node" +LABEL commit=$GIT_COMMIT + +# color, nocolor, json +ENV GOLOG_LOG_FMT=nocolor # go-waku default port -EXPOSE 9000 +EXPOSE 9000 -COPY --from=builder /app/build/waku /usr/local/bin/ - -# Symlink the correct wakunode binary -RUN ln -sv /usr/local/bin/waku /usr/bin/waku +COPY --from=builder /app/build/waku /usr/bin/waku ENTRYPOINT ["/usr/bin/waku"] # By default just show help if called without arguments -CMD ["--help"] \ No newline at end of file +CMD ["--help"] diff --git a/Makefile b/Makefile index ba400f9e..9446b24b 100644 --- a/Makefile +++ b/Makefile @@ -22,4 +22,11 @@ test: go test -v -failfast ./... generate: - go generate ./waku/v2/protocol/pb/generate.go \ No newline at end of file + go generate ./waku/v2/protocol/pb/generate.go + +# build a docker image for the fleet +docker-image: DOCKER_IMAGE_TAG ?= latest +docker-image: DOCKER_IMAGE_NAME ?= statusteam/go-waku:$(DOCKER_IMAGE_TAG) +docker-image: + docker build --tag $(DOCKER_IMAGE_NAME) \ + --build-arg="GIT_COMMIT=$(shell git rev-parse HEAD)" .