-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add multi-arch image via Bazel (#1452)
* Add multi-arch image via Bazel * Drop the commented tags * Move tests to //integration
- Loading branch information
Showing
15 changed files
with
441 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
out/ | ||
bazel-* | ||
*~ | ||
BUILD.bazel | ||
.idea | ||
*.iml | ||
.vagrant |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
load("@bazel_gazelle//:def.bzl", "gazelle") | ||
|
||
# gazelle:prefix github.com/GoogleContainerTools/kaniko | ||
gazelle(name = "gazelle") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
workspace(name = "kaniko") | ||
|
||
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") | ||
|
||
http_archive( | ||
name = "io_bazel_rules_go", | ||
sha256 = "b725e6497741d7fc2d55fcc29a276627d10e43fa5d0bb692692890ae30d98d00", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.3/rules_go-v0.24.3.tar.gz", | ||
"https://github.com/bazelbuild/rules_go/releases/download/v0.24.3/rules_go-v0.24.3.tar.gz", | ||
], | ||
) | ||
|
||
http_archive( | ||
name = "bazel_gazelle", | ||
sha256 = "b85f48fa105c4403326e9525ad2b2cc437babaa6e15a3fc0b1dbab0ab064bc7c", | ||
urls = [ | ||
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", | ||
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.22.2/bazel-gazelle-v0.22.2.tar.gz", | ||
], | ||
) | ||
|
||
load("@io_bazel_rules_go//go:deps.bzl", "go_register_toolchains", "go_rules_dependencies") | ||
load("@bazel_gazelle//:deps.bzl", "gazelle_dependencies") | ||
|
||
go_rules_dependencies() | ||
|
||
go_register_toolchains() | ||
|
||
gazelle_dependencies() | ||
|
||
# Docker rules. | ||
http_archive( | ||
name = "io_bazel_rules_docker", | ||
sha256 = "cf53839c398e464b10ec2fbeb11aedb446f078c28e3b4ce372461bb105ef435c", | ||
strip_prefix = "rules_docker-f8478e57ab7457e403fda474f06ac0bb120d92a7", | ||
urls = ["https://github.com/bazelbuild/rules_docker/archive/f8478e57ab7457e403fda474f06ac0bb120d92a7.tar.gz"], | ||
) | ||
|
||
load( | ||
"@io_bazel_rules_docker//repositories:repositories.bzl", | ||
container_repositories = "repositories", | ||
) | ||
|
||
container_repositories() | ||
|
||
load("@io_bazel_rules_docker//repositories:deps.bzl", container_deps = "deps") | ||
|
||
container_deps() | ||
|
||
load("@io_bazel_rules_docker//repositories:pip_repositories.bzl", "pip_deps") | ||
|
||
pip_deps() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") | ||
load("@io_bazel_rules_docker//container:container.bzl", "container_image") | ||
|
||
go_library( | ||
name = "executor_lib", | ||
srcs = ["main.go"], | ||
importpath = "github.com/GoogleContainerTools/kaniko/cmd/executor", | ||
visibility = ["//visibility:private"], | ||
deps = ["//cmd/executor/cmd"], | ||
) | ||
|
||
go_binary( | ||
name = "executor", | ||
embed = [":executor_lib"], | ||
pure = "on", | ||
visibility = ["//visibility:public"], | ||
) | ||
|
||
ARCHITECTURES = [ | ||
"amd64", | ||
"arm64", | ||
] | ||
|
||
[ | ||
go_binary( | ||
name = "executor_" + arch, | ||
embed = [":executor_lib"], | ||
goarch = arch, | ||
goos = "linux", | ||
pure = "on", | ||
visibility = ["//visibility:public"], | ||
) | ||
for arch in ARCHITECTURES | ||
] | ||
|
||
[ | ||
container_image( | ||
name = "image_" + arch, | ||
architecture = arch, | ||
base = "//files:image", | ||
directory = "/kaniko", | ||
entrypoint = ["/kaniko/executor_" + arch], | ||
env = { | ||
"HOME": "/root", | ||
"USER": "root", | ||
"PATH": "/usr/local/bin:/kaniko", | ||
"SSL_CERT_DIR": "/kaniko/ssl/certs", | ||
"DOCKER_CONFIG": "/kaniko/.docker/", | ||
}, | ||
files = [ | ||
":executor_" + arch, | ||
], | ||
symlinks = { | ||
"/kaniko/executor": "/kaniko/executor_" + arch, | ||
}, | ||
visibility = ["//visibility:public"], | ||
workdir = "/workspace", | ||
) | ||
for arch in ARCHITECTURES | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
load("@io_bazel_rules_docker//container:container.bzl", "container_image") | ||
|
||
container_image( | ||
name = "nsswitch", | ||
directory = "etc", | ||
files = [":nsswitch.conf"], | ||
visibility = ["//visibility:private"], | ||
) | ||
|
||
container_image( | ||
name = "image", | ||
base = ":nsswitch", | ||
directory = "kaniko/ssl/certs", | ||
files = [":ca-certificates.crt"], | ||
visibility = ["//visibility:public"], | ||
) |
Oops, something went wrong.