Make image targets allow for more customization
Customize platform, base image and whether CGO is enabled Signed-off-by: irbekrm <irbekrm@gmail.com>
This commit is contained in:
parent
1ce499a05d
commit
7405fb4e24
28
Makefile
28
Makefile
@ -12,9 +12,23 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# STANDARD OPTIONS
|
||||
###############
|
||||
|
||||
# Set DOCKER_REGISTRY to customise the image docker repo, e.g. "quay.io/jetstack"
|
||||
DOCKER_REGISTRY :=
|
||||
# Set APP_VERSION to customize the image tag, eg "v0.0.5-dev"
|
||||
APP_VERSION :=
|
||||
# Set the target platform to build for. Defaults to linux/amd64
|
||||
PLATFORM := @io_bazel_rules_go//go/toolchain:linux_amd64
|
||||
|
||||
# OPTIONS YOU PROBABLY DON'T NEED TO MODIFY UNLESS DOING SOMETHING VERY SPECIFIC.
|
||||
###############
|
||||
|
||||
# Set an alternative base image https://github.com/jetstack/cert-manager/blob/master/build/BUILD.bazel#L42
|
||||
BASE_IMAGE := static
|
||||
# Set to '' to not disable CGO. Disabled by default.
|
||||
CGO_DISABLED := --@io_bazel_rules_go//go/config:pure
|
||||
HACK_DIR ?= hack
|
||||
|
||||
# Get a list of all binaries to be built
|
||||
@ -49,9 +63,9 @@ help:
|
||||
#
|
||||
# Image targets can be run with optional args DOCKER_REGISTRY and APP_VERSION:
|
||||
#
|
||||
# make images DOCKER_REGISTRY=quay.io/yourusername APP_VERSION=v0.11.0-dev.my-feature
|
||||
# All image targets can be run with optional args DOCKER_REGISTRY, APP_VERSION, PLATFORM
|
||||
#
|
||||
# Images can be pushed with optional args DOCKER_REGISTRY and APP_VERSION:
|
||||
# make images DOCKER_REGISTRY=quay.io/yourusername APP_VERSION=v0.11.0-dev.my-feature PLATFORM=@io_bazel_rules_go//go/toolchain:linux_arm64
|
||||
#
|
||||
# make images_push DOCKER_REGISTRY=quay.io/yourusername APP_VERSION=v0.11.0-dev.my-feature
|
||||
|
||||
@ -110,8 +124,9 @@ images:
|
||||
DOCKER_REGISTRY=$(DOCKER_REGISTRY) \
|
||||
bazel run \
|
||||
--stamp \
|
||||
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \
|
||||
--@io_bazel_rules_go//go/config:pure \
|
||||
--platforms=$(PLATFORM) \
|
||||
--define image_type=$(BASE_IMAGE) \
|
||||
$(CGO_DISABLED) \
|
||||
//build:server-images
|
||||
|
||||
.PHONY: images_push
|
||||
@ -120,6 +135,7 @@ images_push:
|
||||
DOCKER_REGISTRY=$(DOCKER_REGISTRY) \
|
||||
bazel run \
|
||||
--stamp \
|
||||
--platforms=@io_bazel_rules_go//go/toolchain:linux_amd64 \
|
||||
--@io_bazel_rules_go//go/config:pure \
|
||||
--platforms=$(PLATFORM) \
|
||||
--define image_type=$(BASE_IMAGE) \
|
||||
$(CGO_DISABLED) \
|
||||
//:images.push
|
||||
|
||||
Loading…
Reference in New Issue
Block a user