Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf4cd13

Browse filesBrowse files
author
Doug Greiman
committed
Update par files in a Docker container with known-good Python interpreter
1 parent b25495c commit bf4cd13
Copy full SHA for bf4cd13

File tree

2 files changed

+36
-3
lines changed
Filter options

2 files changed

+36
-3
lines changed

‎tools/update_tools/Dockerfile

Copy file name to clipboard
+21Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM gcr.io/gcp-runtimes/ubuntu_16_0_4:latest
2+
3+
# Install Bazel (https://docs.bazel.build/versions/master/install-ubuntu.html)
4+
RUN apt-get update -y && apt-get install openjdk-8-jdk -y
5+
RUN echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | tee /etc/apt/sources.list.d/bazel.list
6+
RUN curl https://bazel.build/bazel-release.pub.gpg | apt-key add -
7+
RUN apt-get update -y && apt-get install bazel -y
8+
RUN bazel help info >/dev/null 2>&1
9+
10+
# Install Python 2.7.12
11+
RUN apt-get install python -y
12+
13+
# Build par files. We have a source and work directory to avoid
14+
# stomping on other files as root.
15+
CMD cp -r /opt/rules_python_source /opt/rules_python && \
16+
cd /opt/rules_python && \
17+
bazel clean && \
18+
bazel build //rules_python:piptool.par //rules_python:whltool.par && \
19+
cp bazel-bin/rules_python/piptool.par bazel-bin/rules_python/whltool.par /opt/rules_python_source/tools/ && \
20+
chown --reference=/opt/rules_python_source/update_tools.sh /opt/rules_python_source/tools/piptool.par /opt/rules_python_source/tools/whltool.par
21+

‎update_tools.sh

Copy file name to clipboardExpand all lines: update_tools.sh
+15-3Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,18 @@
1616

1717
set -euo pipefail
1818

19-
bazel build //rules_python:piptool.par //rules_python:whltool.par
20-
cp bazel-bin/rules_python/piptool.par tools/piptool.par
21-
cp bazel-bin/rules_python/whltool.par tools/whltool.par
19+
usage() {
20+
echo "Usage: $0 [--nodocker]" 1>&2
21+
exit 1
22+
}
23+
24+
if [ "$#" -eq 0 ] ; then
25+
docker build -f tools/update_tools/Dockerfile --tag rules_python:update_tools .
26+
docker run -v"$PWD":/opt/rules_python_source rules_python:update_tools
27+
elif [ "$#" -eq 1 -a "$1" == "--nodocker" ] ; then
28+
bazel build //rules_python:piptool.par //rules_python:whltool.par
29+
cp bazel-bin/rules_python/piptool.par tools/piptool.par
30+
cp bazel-bin/rules_python/whltool.par tools/whltool.par
31+
else
32+
usage
33+
fi

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.