-
Notifications
You must be signed in to change notification settings - Fork 514
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dockerize and Cache Bazel {Local, CI} Builds (#1240)
This PR adds: - A minimal docker wrapper to the bazel GHA workflow to make it reproducible locally - Bazel cache to speed up GHA workflows (down to ~5 minutes from ~40+minutes) This is a no-op for non-bazel workflows and an incremental improvement.
- Loading branch information
1 parent
9be8997
commit 9c8b962
Showing
6 changed files
with
83 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
ARG BASE_IMG=ubuntu:18.04 | ||
FROM ${BASE_IMG} as dev-base | ||
|
||
ARG ARCH="x86_64" | ||
ARG BAZEL_VERSION=5.2.0 | ||
|
||
# Install basic packages | ||
RUN apt-get update && \ | ||
apt-get install -y \ | ||
clang-10 \ | ||
curl \ | ||
git \ | ||
python3-pip \ | ||
python3.8 \ | ||
python3.8-dev \ | ||
wget \ | ||
unzip | ||
|
||
RUN update-alternatives --install /usr/bin/python python /usr/bin/python3.8 10 | ||
RUN update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 10 | ||
|
||
RUN update-alternatives --install /usr/bin/clang clang /usr/bin/clang-10 10 | ||
RUN update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-10 10 | ||
|
||
# Install bazel | ||
RUN wget -q https://github.com/bazelbuild/bazel/releases/download/${BAZEL_VERSION}/bazel-${BAZEL_VERSION}-linux-${ARCH} -O /usr/bin/bazel \ | ||
&& chmod a+x /usr/bin/bazel | ||
|
||
COPY requirements.txt /opt/app/requirements.txt | ||
WORKDIR /opt/app | ||
RUN python -m pip install --upgrade pip | ||
RUN python -m pip install --ignore-installed -r requirements.txt | ||
|
||
WORKDIR /opt/src/torch-mlir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
|
||
cd "$(pwd)/utils/bazel" && bazel build @torch-mlir//... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
docker build -f utils/bazel/docker/Dockerfile \ | ||
-t torch-mlir:dev \ | ||
. | ||
|
||
docker run -it \ | ||
-v "$(pwd)":"/opt/src/torch-mlir" \ | ||
-v "${HOME}/.cache/bazel":"/root/.cache/bazel" \ | ||
torch-mlir:dev |