-
Notifications
You must be signed in to change notification settings - Fork 629
perf(docker): share reactor build across images #3171
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| variable "MAVEN_ARGS" { | ||
| default = "" | ||
| } | ||
|
|
||
| variable "SOURCE_REVISION" { | ||
| default = "local" | ||
| } | ||
|
|
||
| variable "IMAGE_TAG" { | ||
| default = "local" | ||
| } | ||
|
|
||
| variable "CACHE_CHANNEL" { | ||
| default = "latest" | ||
| } | ||
|
|
||
| variable "EXPORT_CACHE" { | ||
| default = false | ||
| } | ||
|
|
||
| target "_common" { | ||
| context = "." | ||
| args = { | ||
| MAVEN_ARGS = MAVEN_ARGS | ||
| SOURCE_REVISION = SOURCE_REVISION | ||
| } | ||
| platforms = [ | ||
| "linux/amd64", | ||
| "linux/arm64", | ||
| ] | ||
| } | ||
|
|
||
| target "build-cache" { | ||
| inherits = ["_common"] | ||
| dockerfile = "hugegraph-pd/Dockerfile" | ||
| target = "build" | ||
| output = ["type=cacheonly"] | ||
| cache-from = [ | ||
| "type=registry,ref=hugegraph/hugegraph:shared-${CACHE_CHANNEL}", | ||
| "type=registry,ref=hugegraph/pd:buildcache-${CACHE_CHANNEL}", | ||
| ] | ||
| cache-to = EXPORT_CACHE ? [ | ||
| "type=registry,ref=hugegraph/hugegraph:shared-${CACHE_CHANNEL},mode=max", | ||
| ] : [] | ||
| } | ||
|
|
||
| target "pd" { | ||
| inherits = ["_common"] | ||
| dockerfile = "hugegraph-pd/Dockerfile" | ||
| tags = ["hugegraph/pd:${IMAGE_TAG}"] | ||
| output = ["type=docker"] | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| cache-from = [ | ||
| "type=registry,ref=hugegraph/hugegraph:shared-${CACHE_CHANNEL}", | ||
| "type=registry,ref=hugegraph/pd:buildcache-${CACHE_CHANNEL}", | ||
| ] | ||
| } | ||
|
|
||
| target "store" { | ||
| inherits = ["_common"] | ||
| dockerfile = "hugegraph-store/Dockerfile" | ||
| tags = ["hugegraph/store:${IMAGE_TAG}"] | ||
| output = ["type=docker"] | ||
| cache-from = [ | ||
| "type=registry,ref=hugegraph/hugegraph:shared-${CACHE_CHANNEL}", | ||
| "type=registry,ref=hugegraph/store:buildcache-${CACHE_CHANNEL}", | ||
| ] | ||
| } | ||
|
|
||
| target "server-hstore" { | ||
| inherits = ["_common"] | ||
| dockerfile = "hugegraph-server/Dockerfile-hstore" | ||
| tags = ["hugegraph/server:${IMAGE_TAG}"] | ||
| output = ["type=docker"] | ||
| cache-from = [ | ||
| "type=registry,ref=hugegraph/hugegraph:shared-${CACHE_CHANNEL}", | ||
| "type=registry,ref=hugegraph/server:buildcache-${CACHE_CHANNEL}", | ||
| ] | ||
| } | ||
|
|
||
| target "server-standalone" { | ||
| inherits = ["_common"] | ||
| dockerfile = "hugegraph-server/Dockerfile" | ||
| tags = ["hugegraph/hugegraph:${IMAGE_TAG}"] | ||
| output = ["type=docker"] | ||
| cache-from = [ | ||
| "type=registry,ref=hugegraph/hugegraph:shared-${CACHE_CHANNEL}", | ||
| "type=registry,ref=hugegraph/hugegraph:buildcache-${CACHE_CHANNEL}", | ||
| ] | ||
| } | ||
|
|
||
| group "default" { | ||
| targets = [ | ||
| "build-cache", | ||
| "pd", | ||
| "store", | ||
| "server-hstore", | ||
| "server-standalone", | ||
| ] | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the stage header ever changes casing or name (
as buildis valid Dockerfile syntax),extract_build_stagereturns empty for every file and the diffs pass vacuously, so the guard silently stops guarding. Reproduced this: rewritingAS buildtoas buildin all four files makes the check pass even with divergentmvnlines. A partial rename is still caught. Cheap fix: assert the reference extraction is non-empty first.