Giuseppe Lavagetto has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/396021 )

Change subject: [WiP] Create an envoy docker image.
......................................................................

[WiP] Create an envoy docker image.

There is no convenient way to reuse the dockerfile that envoproxy offers in
our current build system and with our currently supported distros (the
official image uses ubuntu xenial). So we merge together the script that
is used to generate the "build image" and the steps used to run it and
actually build the software. The actual dockerfile for running the
software is still missing, as are the relevant metadata files.

Change-Id: I4107dab6ca361ed20a8e0daaac02644eb28d74a9
---
A images/envoy/Dockerfile.build
A images/envoy/Dockerfile.build.template
A images/envoy/envoy_build.sh
3 files changed, 73 insertions(+), 0 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/operations/docker-images/production-images 
refs/changes/21/396021/1

diff --git a/images/envoy/Dockerfile.build b/images/envoy/Dockerfile.build
new file mode 100644
index 0000000..48ae72b
--- /dev/null
+++ b/images/envoy/Dockerfile.build
@@ -0,0 +1,5 @@
+FROM docker-registry.wikimedia.org/wikimedia-stretch:latest
+
+COPY envoy_build.sh /bin/envoy_build
+# This build is too strange and convoluted to be properly written down in a 
dockerfile. meh.
+RUN /bin/envoy_build
diff --git a/images/envoy/Dockerfile.build.template 
b/images/envoy/Dockerfile.build.template
new file mode 100644
index 0000000..e1439e9
--- /dev/null
+++ b/images/envoy/Dockerfile.build.template
@@ -0,0 +1,5 @@
+FROM {{ seed_image }}
+
+COPY envoy_build.sh /bin/envoy_build
+# This build is too strange and convoluted to be properly written down in a 
dockerfile. meh.
+RUN /bin/envoy_build
diff --git a/images/envoy/envoy_build.sh b/images/envoy/envoy_build.sh
new file mode 100755
index 0000000..6efdb25
--- /dev/null
+++ b/images/envoy/envoy_build.sh
@@ -0,0 +1,63 @@
+#!/bin/bash
+set -e
+export DEBIAN_FRONTEND=noninteractive
+# Envoy build within a container image build process.
+# This is aimed at reducing to the bare minimum the amount of indirection.
+apt-get update
+apt-get install -y wget software-properties-common make cmake git python 
python-pip \
+        bc libtool automake zip time golang g++ gdb strace
+mkdir /source
+git clone https://github.com/envoyproxy/envoy.git /source
+mkdir /build
+# Copy files where we expect them to be
+(cd /source/ci/build_container && \
+     cp ./build_and_install_deps.sh ./recipe_wrapper.sh ./Makefile /  &&\
+     mkdir /bazel-prebuilt && cp /source/WORKSPACE /bazel-prebuilt/ && \
+     cp -ax /source/bazel /bazel-prebuilt && \
+     mkdir /build_recipes && cp ./build_recipes/*.sh /build_recipes/ )
+
+
+# Install clang
+wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | apt-key add -
+echo 'deb http://apt.llvm.org/stretch/ llvm-toolchain-stretch-5.0 main' > 
/etc/apt/sources.list.d/llvm.list
+apt-get update && apt-get install -y clang-5.0 clang-format-5.0
+# Bazel and related dependencies.
+apt-get install -y openjdk-8-jdk curl
+echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" 
| tee /etc/apt/sources.list.d/bazel.list
+curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
+apt-get update
+apt-get install -y bazel
+rm -rf /var/lib/apt/lists/*
+
+# virtualenv
+pip install virtualenv
+
+# buildifier
+export GOPATH=/usr/lib/go
+go get github.com/bazelbuild/buildifier/buildifier
+
+# GCC for everything.
+export CC=gcc
+export CXX=g++
+export THIRDPARTY_DEPS=/tmp
+export THIRDPARTY_SRC=/thirdparty
+DEPS=$(python <(cat /bazel-prebuilt/bazel/target_recipes.bzl; \
+                echo "print ' '.join(\"${THIRDPARTY_DEPS}/%s.dep\" % r for r 
in set(TARGET_RECIPES.values()))"))
+# TODO(htuch): We build twice as a workaround for 
https://github.com/google/protobuf/issues/3322.
+# Fix this. This will be gone real soon now.
+export THIRDPARTY_BUILD=/thirdparty_build
+export CPPFLAGS="-DNDEBUG"
+echo "Building opt deps ${DEPS}"
+/build_and_install_deps.sh ${DEPS}
+
+echo "Building Bazel-managed deps (//bazel/external:all_external)"
+mkdir /bazel-prebuilt-root /bazel-prebuilt-output
+BAZEL_OPTIONS="--output_user_root=/bazel-prebuilt-root 
--output_base=/bazel-prebuilt-output"
+cd /bazel-prebuilt
+for BAZEL_MODE in opt dbg fastbuild; do
+    bazel ${BAZEL_OPTIONS} build -c "${BAZEL_MODE}" 
//bazel/external:all_external
+done
+# Allow access by non-root for building.
+chmod -R a+rX /bazel-prebuilt-root /bazel-prebuilt-output
+cd /source
+./ci/do_ci.sh bazel.release.server_only

-- 
To view, visit https://gerrit.wikimedia.org/r/396021
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I4107dab6ca361ed20a8e0daaac02644eb28d74a9
Gerrit-PatchSet: 1
Gerrit-Project: operations/docker-images/production-images
Gerrit-Branch: master
Gerrit-Owner: Giuseppe Lavagetto <glavage...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to