[BCID] Split of cd-base image from CD image

Change-Id: I517d1c1783f2dc1921587a120aec6fbfb72e95de
Reviewed-on: https://skia-review.googlesource.com/c/buildbot/+/583458
Auto-Submit: Eric Boren <borenet@google.com>
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
diff --git a/WORKSPACE b/WORKSPACE
index 4150b7b..ccc98bf 100644
--- a/WORKSPACE
+++ b/WORKSPACE
@@ -323,6 +323,15 @@
     repository = "skia-public/base-cipd",
 )
 
+# Pulls the gcr.io/skia-public/cd-base container, needed by some apps that use the
+# skia_app_container macro.
+container_pull(
+    name = "cd-base",
+    digest = "sha256:96e80a7bd78ae573155416853dcfbb1c00f997d4aef3c53d5e7058fb9df8946f",
+    registry = "gcr.io",
+    repository = "skia-public/cd-base",
+)
+
 # Pulls the gcr.io/skia-public/skia-build-tools container, needed by some apps that
 # build skia.
 container_pull(
diff --git a/cd/BUILD.bazel b/cd/BUILD.bazel
new file mode 100644
index 0000000..e140355
--- /dev/null
+++ b/cd/BUILD.bazel
@@ -0,0 +1,16 @@
+load("//bazel:skia_app_container.bzl", "skia_app_container")
+
+skia_app_container(
+    name = "cd_container",
+    base_image = "@cd-base//image",
+    default_user = "root",
+    dirs = {
+        "/usr/local/bin": [
+            [
+                "//cd/go/build-images:build-images",
+                "0755",
+            ],
+        ],
+    },
+    repository = "skia-public/cd",
+)
diff --git a/cd/build_release b/cd/build_release
index 9636a96..b9c92b1 100755
--- a/cd/build_release
+++ b/cd/build_release
@@ -3,7 +3,7 @@
 
 set -x -e
 
-APPNAME=cd
+APPNAME=cd-base
 
 # Copy files into the right locations in ${ROOT}.
 copy_release_files()
@@ -12,7 +12,6 @@
 INSTALL_DIR="install -d --verbose --backup=none"
 ${INSTALL} --mode=644 -T Dockerfile                  ${ROOT}/Dockerfile
 ${INSTALL} --mode=644 -T ../infra/config/recipes.cfg ${ROOT}/recipes.cfg
-${INSTALL} --mode=755 -T ../_bazel_bin/cd/go/build-images/build-images_/build-images ${ROOT}/build-images
 }
 
 source ../bash/docker_build.sh