Skip to content

Instantly share code, notes, and snippets.

@Matts966
Last active June 8, 2020 10:47
Show Gist options
  • Save Matts966/dd5874016f7e4f7d5bc1fcdf75474c07 to your computer and use it in GitHub Desktop.
Save Matts966/dd5874016f7e4f7d5bc1fcdf75474c07 to your computer and use it in GitHub Desktop.
FROM l.gcr.io/google/bazel:1.0.0 as builder
# Use gcc because clang can't build m4
RUN apt-get update && \
apt-get install build-essential software-properties-common -y && \
add-apt-repository ppa:ubuntu-toolchain-r/test -y && \
apt-get update && \
# Use gcc-9 for using std::filesystem api
apt-get install --no-install-recommends -y make gcc-9 g++-9 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 900 \
--slave /usr/bin/g++ g++ /usr/bin/g++-9
ENV CC /usr/bin/gcc
COPY . /work/zetasql
WORKDIR /work/zetasql
RUN bazel build //zetasql/experimental:format && \
cp ./bazel-bin/zetasql/experimental/format .
FROM gcr.io/distroless/cc
COPY --from=builder /work/zetasql/bazel-bin/zetasql/experimental/format /usr/bin/format
COPY --from=builder /usr/lib/x86_64-linux-gnu/libstdc++.so.6 /usr/lib/x86_64-linux-gnu/libstdc++.so.6
WORKDIR /home
ENTRYPOINT [ "format" ]
CMD [ "." ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment