Multistage docker containers with RBE swiftshader support (#3065)
Refactors Docker setup to enable multistage builds and fully support
Vulkan.
1. Vulkan is now supported in all our build configurations and
IREE_VULKAN_DISABLE is set to false in all build scripts.
2. Our docker containers use multi-stage builds to reduce duplication
and image size.
3. Directory names match image names rather than having arbitrary
underscore/dash distinction (I kept mistyping this).
New vs old images:
https://gist.github.com/GMNGeoffrey/6ea51a6035f3eb8fac11ff4bdbd6edc0
Fixes https://github.com/google/iree/issues/2651
diff --git a/build_tools/docker/cmake-python-vulkan/Dockerfile b/build_tools/docker/cmake-python-vulkan/Dockerfile
new file mode 100644
index 0000000..a20221b
--- /dev/null
+++ b/build_tools/docker/cmake-python-vulkan/Dockerfile
@@ -0,0 +1,38 @@
+# Copyright 2020 Google LLC
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# A base image for building IREE using CMake and running Vulkan tests. Requires
+# a child image to provide a Vulkan ICD.
+
+FROM gcr.io/iree-oss/cmake-python AS final
+
+# It would be nice to have a separate install vulkan image and copy from that,
+# but I don't know all the files that installing the vulkan-sdk adds.
+RUN apt-get update && apt-get install -y wget
+
+ARG VULKAN_SDK_VERSION=1.2.141
+# Disable apt-key parse waring. If someone knows how to do whatever the "proper"
+# thing is then feel free. The warning complains about parsing apt-key output,
+# which we're not even doing.
+ARG APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=1
+
+RUN wget -qO - http://packages.lunarg.com/lunarg-signing-key-pub.asc \
+ | apt-key add - \
+ && wget -qO \
+ "/etc/apt/sources.list.d/lunarg-vulkan-${VULKAN_SDK_VERSION?}-bionic.list" \
+ "http://packages.lunarg.com/vulkan/${VULKAN_SDK_VERSION?}/lunarg-vulkan-${VULKAN_SDK_VERSION?}-bionic.list" \
+ && apt-get update \
+ && apt-get install -y vulkan-sdk
+
+RUN rm /usr/bin/wget