8000 Merge pull request #91 from bazelbuild/dgreiman/docker · serve-robotics/rules_python@8b5d068 · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 8b5d068

Browse files
author
Douglas Greiman
authored
Merge pull request bazel-contrib#91 from bazelbuild/dgreiman/docker
Update par files in a Docker container with known-good Python
2 parents b25495c + 23790d0 commit 8b5d068

File tree

4 files changed

+36
-3
lines changed

4 files changed

+36
-3
lines changed

tools/piptool.par

1.1 KB
Binary file not shown.

tools/update_tools/Dockerfile

Lines 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+

tools/whltool.par

1.1 KB
Binary file not shown.

update_tools.sh

Lines 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 --no-cache -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