Skip to content

Commit 9e2bec3

Browse files
committed
enhance docker build, using cache
1 parent 6b0d402 commit 9e2bec3

8 files changed

+88
-116
lines changed

.github/workflows/nightly.yml

+30-10
Original file line numberDiff line numberDiff line change
@@ -62,14 +62,6 @@ jobs:
6262
docker:
6363
name: build docker image
6464
runs-on: [self-hosted, nebula]
65-
strategy:
66-
fail-fast: false
67-
matrix:
68-
service:
69-
- graphd
70-
- metad
71-
- storaged
72-
- tools
7365
steps:
7466
- uses: webiny/action-post-run@2.0.1
7567
with:
@@ -84,10 +76,38 @@ jobs:
8476
- uses: docker/build-push-action@v2
8577
with:
8678
context: .
87-
file: ./docker/Dockerfile.${{ matrix.service }}
79+
file: ./docker/Dockerfile
80+
platforms: linux/amd64,linux/arm64
81+
tags: |
82+
vesoft/nebula-graphd:nightly
83+
target: graphd
84+
push: true
85+
- uses: docker/build-push-action@v2
86+
with:
87+
context: .
88+
file: ./docker/Dockerfile
89+
platforms: linux/amd64,linux/arm64
90+
tags: |
91+
vesoft/nebula-storaged:nightly
92+
target: storaged
93+
push: true
94+
- uses: docker/build-push-action@v2
95+
with:
96+
context: .
97+
file: ./docker/Dockerfile
98+
platforms: linux/amd64,linux/arm64
99+
tags: |
100+
vesoft/nebula-metad:nightly
101+
target: metad
102+
push: true
103+
- uses: docker/build-push-action@v2
104+
with:
105+
context: .
106+
file: ./docker/Dockerfile
88107
platforms: linux/amd64,linux/arm64
89108
tags: |
90-
vesoft/nebula-${{ matrix.service }}:nightly
109+
vesoft/nebula-tools:nightly
110+
target: tools
91111
push: true
92112

93113
coverage:

.github/workflows/rc.yml

+50-11
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,6 @@ jobs:
6868
docker_build:
6969
name: docker-build
7070
runs-on: [self-hosted, nebula]
71-
strategy:
72-
fail-fast: false
73-
matrix:
74-
service:
75-
- graphd
76-
- metad
77-
- storaged
78-
- tools
7971
steps:
8072
- uses: webiny/action-post-run@2.0.1
8173
with:
@@ -101,15 +93,62 @@ jobs:
10193
- uses: docker/build-push-action@v2
10294
with:
10395
context: .
104-
file: ./docker/Dockerfile.${{ matrix.service }}
96+
file: ./docker/Dockerfile
97+
platforms: linux/amd64,linux/arm64
98+
tags: |
99+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-graphd:${{ steps.tagname.outputs.tag }}
100+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-graphd:${{ steps.tagname.outputs.majorver }}
101+
${{ steps.docker.outputs.tag }}
102+
push: true
103+
target: graphd
104+
build-args: |
105+
BRANCH=${{ steps.tagname.outputs.tag }}
106+
VERSION=${{ steps.tagname.outputs.tagnum }}
107+
108+
- uses: docker/build-push-action@v2
109+
with:
110+
context: .
111+
file: ./docker/Dockerfile
112+
platforms: linux/amd64,linux/arm64
113+
tags: |
114+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-storaged:${{ steps.tagname.outputs.tag }}
115+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-storaged:${{ steps.tagname.outputs.majorver }}
116+
${{ steps.docker.outputs.tag }}
117+
push: true
118+
target: storaged
119+
build-args: |
120+
BRANCH=${{ steps.tagname.outputs.tag }}
121+
VERSION=${{ steps.tagname.outputs.tagnum }}
122+
123+
- uses: docker/build-push-action@v2
124+
with:
125+
context: .
126+
file: ./docker/Dockerfile
127+
platforms: linux/amd64,linux/arm64
128+
tags: |
129+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-metad:${{ steps.tagname.outputs.tag }}
130+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-metad:${{ steps.tagname.outputs.majorver }}
131+
${{ steps.docker.outputs.tag }}
132+
push: true
133+
target: metad
134+
build-args: |
135+
BRANCH=${{ steps.tagname.outputs.tag }}
136+
VERSION=${{ steps.tagname.outputs.tagnum }}
137+
138+
- uses: docker/build-push-action@v2
139+
with:
140+
context: .
141+
file: ./docker/Dockerfile
105142
platforms: linux/amd64,linux/arm64
106143
tags: |
107-
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-${{ matrix.service }}:${{ steps.tagname.outputs.tag }}
108-
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-${{ matrix.service }}:${{ steps.tagname.outputs.majorver }}
144+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-tools:${{ steps.tagname.outputs.tag }}
145+
${{ secrets.HARBOR_REGISTRY }}/vesoft/nebula-tools:${{ steps.tagname.outputs.majorver }}
109146
${{ steps.docker.outputs.tag }}
110147
push: true
148+
target: tools
111149
build-args: |
112150
BRANCH=${{ steps.tagname.outputs.tag }}
151+
VERSION=${{ steps.tagname.outputs.tagnum }}
113152
114153
test:
115154
name: test

docker/Dockerfile

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
FROM vesoft/nebula-dev:centos7 as builder
22

33
ARG BRANCH=master
4-
4+
ARG VERSION=
55
COPY . /home/nebula/BUILD
66

77
RUN cd /home/nebula/BUILD/package \
8-
&& ./package.sh -n OFF -b ${BRANCH} -c OFF
8+
&& [[ -z "${VERSION}" ]] \
9+
&& ./package.sh -n OFF -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF \
10+
|| ./package.sh -n OFF -v ${VERSION} -b ${BRANCH} -t RelWithDebInfo -s TRUE -c OFF
911

1012
FROM centos:7 as graphd
1113

docker/Dockerfile.graphd

-23
This file was deleted.

docker/Dockerfile.metad

-23
This file was deleted.

docker/Dockerfile.storaged

-23
This file was deleted.

docker/Dockerfile.tools

-20
This file was deleted.

docker/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
Following docker images will be ready in production.
44

5-
- [vesoft/nebula-graphd](https://hub.docker.com/r/vesoft/nebula-graphd): nebula-graphd service built with `Dockerfile.graphd`
6-
- [vesoft/nebula-metad](https://hub.docker.com/r/vesoft/nebula-metad): nebula-metad service built with `Dockerfile.metad`
7-
- [vesoft/nebula-storaged](https://hub.docker.com/r/vesoft/nebula-storaged): nebula-storaged service built with `Dockerfile.storaged`
8-
- [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
5+
- [vesoft/nebula-graphd](https://hub.docker.com/r/vesoft/nebula-graphd): nebula-graphd service built with `Dockerfile` and target `graphd`
6+
- [vesoft/nebula-metad](https://hub.docker.com/r/vesoft/nebula-metad): nebula-metad service built with `Dockerfile` and target `metad`
7+
- [vesoft/nebula-storaged](https://hub.docker.com/r/vesoft/nebula-storaged): nebula-storaged service built with `Dockerfile` and target `storaged`
8+
- [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

0 commit comments

Comments
 (0)