From 5d96c60027502589fb8dc5f7e2e25ce3c7bfe5a8 Mon Sep 17 00:00:00 2001 From: "Harris.Chu" <1726587+HarrisChu@users.noreply.github.com> Date: Fri, 25 Mar 2022 17:34:33 +0800 Subject: [PATCH] fix version in docker image and Revert 4068 (#4080) * Revert "enhance docker build, using cache" This reverts commit 9e2bec3ce4867a81f881e38aba9b63513847967c. * fix docker version Co-authored-by: Sophie <84560950+Sophie-Xie@users.noreply.github.com> --- .github/workflows/nightly.yml | 40 ++++++---------------- .github/workflows/rc.yml | 62 +++++++---------------------------- docker/Dockerfile | 1 + docker/Dockerfile.graphd | 26 +++++++++++++++ docker/Dockerfile.metad | 26 +++++++++++++++ docker/Dockerfile.storaged | 26 +++++++++++++++ docker/Dockerfile.tools | 23 +++++++++++++ docker/README.md | 8 ++--- 8 files changed, 128 insertions(+), 84 deletions(-) create mode 100644 docker/Dockerfile.graphd create mode 100644 docker/Dockerfile.metad create mode 100644 docker/Dockerfile.storaged create mode 100644 docker/Dockerfile.tools diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 7769d901f17..775b04c20a7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -62,6 +62,14 @@ jobs: docker: name: build docker image runs-on: [self-hosted, nebula] + strategy: + fail-fast: false + matrix: + service: + - graphd + - metad + - storaged + - tools steps: - uses: webiny/action-post-run@2.0.1 with: @@ -76,38 +84,10 @@ jobs: - uses: docker/build-push-action@v2 with: context: . - file: ./docker/Dockerfile - platforms: linux/amd64,linux/arm64 - tags: | - vesoft/nebula-graphd:nightly - target: graphd - push: true - - uses: docker/build-push-action@v2 - with: - context: . - file: ./docker/Dockerfile - platforms: linux/amd64,linux/arm64 - tags: | - vesoft/nebula-storaged:nightly - target: storaged - push: true - - uses: docker/build-push-action@v2 - with: - context: . - file: ./docker/Dockerfile - platforms: linux/amd64,linux/arm64 - tags: | - vesoft/nebula-metad:nightly - target: metad - push: true - - uses: docker/build-push-action@v2 - with: - context: . - file: ./docker/Dockerfile + file: ./docker/Dockerfile.${{ matrix.service }} platforms: linux/amd64,linux/arm64 tags: | - vesoft/nebula-tools:nightly - target: tools + vesoft/nebula-${{ matrix.service }}:nightly push: true coverage: diff --git a/.github/workflows/rc.yml b/.github/workflows/rc.yml index c6fe00cdca8..070dabdc7e9 100644 --- a/.github/workflows/rc.yml +++ b/.github/workflows/rc.yml @@ -68,6 +68,14 @@ jobs: docker_build: name: docker-build runs-on: [self-hosted, nebula] + strategy: + fail-fast: false + matrix: + service: + - graphd + - metad + - storaged + - tools steps: - uses: webiny/action-post-run@2.0.1 with: @@ -93,62 +101,16 @@ jobs: - uses: docker/build-push-action@v2 with: context: . - file: ./docker/Dockerfile - platforms: linux/amd64,linux/arm64 - tags: | - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-graphd:${{ steps.tagname.outputs.tag }} - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-graphd:${{ steps.tagname.outputs.majorver }} - ${{ steps.docker.outputs.tag }} - push: true - target: graphd - build-args: | - BRANCH=${{ steps.tagname.outputs.tag }} - VERSION=${{ steps.tagname.outputs.tagnum }} - - - uses: docker/build-push-action@v2 - with: - context: . - file: ./docker/Dockerfile - platforms: linux/amd64,linux/arm64 - tags: | - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-storaged:${{ steps.tagname.outputs.tag }} - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-storaged:${{ steps.tagname.outputs.majorver }} - ${{ steps.docker.outputs.tag }} - push: true - target: storaged - build-args: | - BRANCH=${{ steps.tagname.outputs.tag }} - VERSION=${{ steps.tagname.outputs.tagnum }} - - - uses: docker/build-push-action@v2 - with: - context: . - file: ./docker/Dockerfile - platforms: linux/amd64,linux/arm64 - tags: | - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-metad:${{ steps.tagname.outputs.tag }} - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-metad:${{ steps.tagname.outputs.majorver }} - ${{ steps.docker.outputs.tag }} - push: true - target: metad - build-args: | - BRANCH=${{ steps.tagname.outputs.tag }} - VERSION=${{ steps.tagname.outputs.tagnum }} - - - uses: docker/build-push-action@v2 - with: - context: . - file: ./docker/Dockerfile + file: ./docker/Dockerfile.${{ matrix.service }} platforms: linux/amd64,linux/arm64 tags: | - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-tools:${{ steps.tagname.outputs.tag }} - ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-tools:${{ steps.tagname.outputs.majorver }} + ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-${{ matrix.service }}:${{ steps.tagname.outputs.tag }} + ${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-${{ matrix.service }}:${{ steps.tagname.outputs.majorver }} ${{ steps.docker.outputs.tag }} push: true - target: tools build-args: | BRANCH=${{ steps.tagname.outputs.tag }} - VERSION=${{ steps.tagname.outputs.tagnum }} + VERSON=${{ steps.tagname.outputs.tagnum }} test: name: test diff --git a/docker/Dockerfile b/docker/Dockerfile index e640e27166b..0a7a8bfcda4 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -2,6 +2,7 @@ FROM vesoft/nebula-dev:centos7 as builder ARG BRANCH=master ARG VERSION= + COPY . /home/nebula/BUILD RUN cd /home/nebula/BUILD/package \ diff --git a/docker/Dockerfile.graphd b/docker/Dockerfile.graphd new file mode 100644 index 00000000000..75bf3e3984e --- /dev/null +++ b/docker/Dockerfile.graphd @@ -0,0 +1,26 @@ +FROM vesoft/nebula-dev:centos7 as builder + +ARG BRANCH=master +ARG VERSION= + +COPY . /home/nebula/BUILD + +RUN cd /home/nebula/BUILD/package \ + && [[ -z "${VERSION}" ]] \ + && ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \ + || ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON + +FROM centos:7 + +COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm +COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-graph.rpm /usr/local/nebula/nebula-graphd.rpm + +WORKDIR /usr/local/nebula + +RUN rpm -ivh *.rpm \ + && mkdir -p ./{logs,data,pids} \ + && rm -rf *.rpm + +EXPOSE 9669 19669 19670 + +ENTRYPOINT ["/usr/local/nebula/bin/nebula-graphd", "--flagfile=/usr/local/nebula/etc/nebula-graphd.conf", "--daemonize=false", "--containerized=true"] diff --git a/docker/Dockerfile.metad b/docker/Dockerfile.metad new file mode 100644 index 00000000000..b4ab34f8409 --- /dev/null +++ b/docker/Dockerfile.metad @@ -0,0 +1,26 @@ +FROM vesoft/nebula-dev:centos7 as builder + +ARG BRANCH=master +ARG VERSION= + +COPY . /home/nebula/BUILD + +RUN cd /home/nebula/BUILD/package \ + && [[ -z "${VERSION}" ]] \ + && ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \ + || ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON + +FROM centos:7 + +COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm +COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-meta.rpm /usr/local/nebula/nebula-metad.rpm + +WORKDIR /usr/local/nebula + +RUN rpm -ivh *.rpm \ + && mkdir -p ./{logs,data,pids} \ + && rm -rf *.rpm + +EXPOSE 9559 9560 19559 19560 + +ENTRYPOINT ["/usr/local/nebula/bin/nebula-metad", "--flagfile=/usr/local/nebula/etc/nebula-metad.conf", "--daemonize=false", "--containerized=true"] diff --git a/docker/Dockerfile.storaged b/docker/Dockerfile.storaged new file mode 100644 index 00000000000..6ca29687e37 --- /dev/null +++ b/docker/Dockerfile.storaged @@ -0,0 +1,26 @@ +FROM vesoft/nebula-dev:centos7 as builder + +ARG BRANCH=master +ARG VERSION= + +COPY . /home/nebula/BUILD + +RUN cd /home/nebula/BUILD/package \ + && [[ -z "${VERSION}" ]] \ + && ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \ + || ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON + +FROM centos:7 + +COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-common.rpm /usr/local/nebula/nebula-common.rpm +COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-storage.rpm /usr/local/nebula/nebula-storaged.rpm + +WORKDIR /usr/local/nebula + +RUN rpm -ivh *.rpm \ + && mkdir -p ./{logs,data,pids} \ + && rm -rf *.rpm + +EXPOSE 9777 9778 9779 9780 19779 19780 + +ENTRYPOINT ["/usr/local/nebula/bin/nebula-storaged", "--flagfile=/usr/local/nebula/etc/nebula-storaged.conf", "--daemonize=false", "--containerized=true"] diff --git a/docker/Dockerfile.tools b/docker/Dockerfile.tools new file mode 100644 index 00000000000..fd696809109 --- /dev/null +++ b/docker/Dockerfile.tools @@ -0,0 +1,23 @@ +FROM vesoft/nebula-dev:centos7 as builder + +ARG BRANCH=master +ARG VERSION= + +COPY . /home/nebula/BUILD + +RUN cd /home/nebula/BUILD/package \ + && [[ -z "${VERSION}" ]] \ + && ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON \ + || ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF -k ON + +FROM centos:7 + +COPY --from=builder /home/nebula/BUILD/pkg-build/cpack_output/nebula-*-tool.rpm /usr/local/nebula/nebula-tool.rpm + +WORKDIR /usr/local/nebula + +RUN rpm -ivh *.rpm \ + && rm -rf *.rpm + +# default entrypoint +ENTRYPOINT ["/usr/local/nebula/bin/db_dump"] diff --git a/docker/README.md b/docker/README.md index 5f40c1fd160..1e626b9b725 100644 --- a/docker/README.md +++ b/docker/README.md @@ -2,7 +2,7 @@ Following docker images will be ready in production. -- [vesoft/nebula-graphd](https://hub.docker.com/r/vesoft/nebula-graphd): nebula-graphd service built with `Dockerfile` and target `graphd` -- [vesoft/nebula-metad](https://hub.docker.com/r/vesoft/nebula-metad): nebula-metad service built with `Dockerfile` and target `metad` -- [vesoft/nebula-storaged](https://hub.docker.com/r/vesoft/nebula-storaged): nebula-storaged service built with `Dockerfile` and target `storaged` -- [vesoft/nebula-tools](https://hub.docker.com/r/vesoft/nebula-tools): nebula tools built with `Dockerfile` and target `tools`, including db_dump, meta_dump and db_upgrader +- [vesoft/nebula-graphd](https://hub.docker.com/r/vesoft/nebula-graphd): nebula-graphd service built with `Dockerfile.graphd` +- [vesoft/nebula-metad](https://hub.docker.com/r/vesoft/nebula-metad): nebula-metad service built with `Dockerfile.metad` +- [vesoft/nebula-storaged](https://hub.docker.com/r/vesoft/nebula-storaged): nebula-storaged service built with `Dockerfile.storaged` +- [vesoft/nebula-tools](https://hub.docker.com/r/vesoft/nebula-tools): nebula tools built with `Dockerfile.tools`, including db_dump, meta_dump and db_upgrader