From 673a965f840d44a57d5e4112a8ecef08de9b7d5a Mon Sep 17 00:00:00 2001 From: Alex Eagle Date: Thu, 27 Jul 2023 12:39:26 -0700 Subject: [PATCH] WIP: py interpreter --- oci_python_image/MODULE.bazel | 12 +++++++++++- oci_python_image/interpreter_as_layer/BUILD.bazel | 14 ++++++++++++++ .../{hello_world => use_python_base}/BUILD.bazel | 0 .../{hello_world => use_python_base}/__init__.py | 0 .../{hello_world => use_python_base}/__main__.py | 0 .../{hello_world => use_python_base}/app.py | 0 .../{hello_world => use_python_base}/test.yaml | 0 7 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 oci_python_image/interpreter_as_layer/BUILD.bazel rename oci_python_image/{hello_world => use_python_base}/BUILD.bazel (100%) rename oci_python_image/{hello_world => use_python_base}/__init__.py (100%) rename oci_python_image/{hello_world => use_python_base}/__main__.py (100%) rename oci_python_image/{hello_world => use_python_base}/app.py (100%) rename oci_python_image/{hello_world => use_python_base}/test.yaml (100%) diff --git a/oci_python_image/MODULE.bazel b/oci_python_image/MODULE.bazel index 44e86f54..70974890 100644 --- a/oci_python_image/MODULE.bazel +++ b/oci_python_image/MODULE.bazel @@ -27,4 +27,14 @@ oci.pull( image = "python", ) -use_repo(oci, "distroless_python") \ No newline at end of file +oci.pull( + name = "distroless_base", + digest = "sha256:ccaef5ee2f1850270d453fdf700a5392534f8d1a8ca2acda391fbb6a06b81c86", + image = "gcr.io/distroless/base", + platforms = [ + "linux/amd64", + "linux/arm64", + ], +) + +use_repo(oci, "distroless_base", "distroless_python") \ No newline at end of file diff --git a/oci_python_image/interpreter_as_layer/BUILD.bazel b/oci_python_image/interpreter_as_layer/BUILD.bazel new file mode 100644 index 00000000..281e8daa --- /dev/null +++ b/oci_python_image/interpreter_as_layer/BUILD.bazel @@ -0,0 +1,14 @@ +pkg_tar( + name = "interpreter", + srcs = ["@rules_python//python:current_py_toolchain"], + extension = "tar.gz", + package_dir = "/opt/python", + strip_prefix = ".", +) + +oci_image( + name = "image", + base = "@distroless_base", + entrypoint = ["/opt/hello_world/hello_world_bin"], + tars = [":hello_world_layer"], +) diff --git a/oci_python_image/hello_world/BUILD.bazel b/oci_python_image/use_python_base/BUILD.bazel similarity index 100% rename from oci_python_image/hello_world/BUILD.bazel rename to oci_python_image/use_python_base/BUILD.bazel diff --git a/oci_python_image/hello_world/__init__.py b/oci_python_image/use_python_base/__init__.py similarity index 100% rename from oci_python_image/hello_world/__init__.py rename to oci_python_image/use_python_base/__init__.py diff --git a/oci_python_image/hello_world/__main__.py b/oci_python_image/use_python_base/__main__.py similarity index 100% rename from oci_python_image/hello_world/__main__.py rename to oci_python_image/use_python_base/__main__.py diff --git a/oci_python_image/hello_world/app.py b/oci_python_image/use_python_base/app.py similarity index 100% rename from oci_python_image/hello_world/app.py rename to oci_python_image/use_python_base/app.py diff --git a/oci_python_image/hello_world/test.yaml b/oci_python_image/use_python_base/test.yaml similarity index 100% rename from oci_python_image/hello_world/test.yaml rename to oci_python_image/use_python_base/test.yaml