diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ac51a05 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +bazel-* diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 0000000..e69de29 diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 0000000..bf36589 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,35 @@ +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +http_archive( + name = "io_bazel_rules_docker", + sha256 = "1698624e878b0607052ae6131aa216d45ebb63871ec497f26c67455b34119c80", + strip_prefix = "rules_docker-0.15.0", + urls = ["https://github.com/bazelbuild/rules_docker/releases/download/v0.15.0/rules_docker-v0.15.0.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//container:container.bzl", "container_pull") + +container_pull( + name = "distroless", + digest = "sha256:f2d2b4f3b53f952d74148ad1242f3d36904598b33cd6411ee886088e0744270e", + registry = "gcr.io", + repository = "distroless/static-debian10", +) + +http_archive( + name = "terraform_0.13.0_linux_amd64", + build_file_content = "exports_files([\"terraform\"])", + sha256 = "9ed437560faf084c18716e289ea712c784a514bdd7f2796549c735d439dbe378", + urls = ["https://releases.hashicorp.com/terraform/0.13.0/terraform_0.13.0_linux_amd64.zip"], +) diff --git a/terraform/BUILD.bazel b/terraform/BUILD.bazel new file mode 100644 index 0000000..64d2e6e --- /dev/null +++ b/terraform/BUILD.bazel @@ -0,0 +1,21 @@ +load("@io_bazel_rules_docker//container:container.bzl", "container_image", "container_push") + +container_image( + name = "0.13.0", + base = "@distroless//image", + cmd = "help", + directory = "/bin/", + entrypoint = ["/bin/terraform"], + files = ["@terraform_0.13.0_linux_amd64//:terraform"], + mode = "0o755", + repository = "quay.io/hadrienpatte", +) + +container_push( + name = "0.13.0_push", + format = "Docker", + image = ":0.13.0", + registry = "quay.io", + repository = "hadrienpatte/{}".format(package_name()), + tag = "0.13.0", +)