Bug 1879592 - Create a "recipes" directory for shared Docker image snippets. r=dandarnell

Differential Revision: https://phabricator.services.mozilla.com/D201572

--HG--
rename : taskcluster/docker/tb-snap/make_venv.sh => taskcluster/docker/recipes/make_venv.sh
extra : amend_source : 5ee9f2666dd065c7581c39f0db270008148b2a06
This commit is contained in:
Rob Lemley 2024-02-14 09:02:19 +02:00
Родитель 3bf895dbfa
Коммит a09954b9f2
1 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,23 @@
#!/usr/bin/env bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
# Arguments: $1 - path to the requirements file
# Arguments: $2 - name of virtualenv to create under /builds/worker/venvs
#
# The script will be create the environment and install from the
# requirements file.
# It's up to the image itself to figure out how to use it.
set -xe
VENV_DIR=${VENV_DIR:-"/builds/worker/venvs"}
VENV_NAME=${2:-"venv"}
# Ensure venvs directory exists
mkdir -p "$VENV_DIR" && cd "$VENV_DIR"
# Create Python virtual environment and install dependencies
python3 -m venv --system-site-packages "$VENV_NAME"
source "./$VENV_NAME/bin/activate"
python3 -m pip install -r "$1"