blob: ba497ea4b3c307cf59294ef051fe4b304cf469f9 [file] [log] [blame]
Philipp Schrader8ac22f32023-12-30 17:37:15 -08001#!/bin/bash
2
3set -o errexit
4set -o nounset
5set -o pipefail
6
7# --- begin runfiles.bash initialization v2 ---
8# Copy-pasted from the Bazel Bash runfiles library v2.
9set -uo pipefail; set +e; f=bazel_tools/tools/bash/runfiles/runfiles.bash
10source "${RUNFILES_DIR:-/dev/null}/$f" 2>/dev/null || \
11 source "$(grep -sm1 "^$f " "${RUNFILES_MANIFEST_FILE:-/dev/null}" | cut -f2- -d' ')" 2>/dev/null || \
12 source "$0.runfiles/$f" 2>/dev/null || \
13 source "$(grep -sm1 "^$f " "$0.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
14 source "$(grep -sm1 "^$f " "$0.exe.runfiles_manifest" | cut -f2- -d' ')" 2>/dev/null || \
15 { echo>&2 "ERROR: cannot find $f"; exit 1; }; f=; set -e
16# --- end runfiles.bash initialization v2 ---
17
18DOCKERFILE="$(rlocation org_frc971/tools/python/update_helper_files/Dockerfile)"
19CONTEXT_DIR="$(dirname "${DOCKERFILE}")"
20CONTAINER_TAG="pip-lock:${USER}"
21
22# Build the container that has the bare minimum to run the various setup.py
23# scripts from our dependencies.
24docker build \
25 --file="${DOCKERFILE}" \
26 --tag="${CONTAINER_TAG}" \
27 "${CONTEXT_DIR}"
28
29# Run the actual update. The assumption here is that mounting the user's home
30# directory is sufficient to allow the tool to run inside the container without
31# any issues. I.e. the cache and the source tree are available in the
32# container.
33docker run \
34 --rm \
35 --tty \
36 --env BUILD_WORKSPACE_DIRECTORY="${BUILD_WORKSPACE_DIRECTORY}" \
37 --workdir "${PWD}" \
38 --volume "${HOME}:${HOME}" \
39 "${CONTAINER_TAG}" \
40 "$@"