Create a new user for the container runtime

without root permission
This commit is contained in:
mauwii
2023-02-07 22:31:44 +01:00
committed by Matthias Wild
parent e8f9ab82ed
commit 3833b28132
3 changed files with 26 additions and 15 deletions

View File

@ -1,11 +1,13 @@
#!/usr/bin/env bash
if [[ -z "$PIP_EXTRA_INDEX_URL" ]]; then
# Activate virtual environment if not already activated
if [[ -z $VIRTUAL_ENV ]]; then
[[ -e "$(dirname "${BASH_SOURCE[0]}")/../.venv/bin/activate" ]] \
&& source "$(dirname "${BASH_SOURCE[0]}")/../.venv/bin/activate"
fi
# Decide which container flavor to build if not specified
if [[ -z "$CONTAINER_FLAVOR" ]] && python -c "import torch" &>/dev/null; then
# Check for CUDA and ROCm
@ -19,6 +21,7 @@ if [[ -z "$PIP_EXTRA_INDEX_URL" ]]; then
CONTAINER_FLAVOR="cpu"
fi
fi
# Set PIP_EXTRA_INDEX_URL based on container flavor
if [[ "$CONTAINER_FLAVOR" == "rocm" ]]; then
PIP_EXTRA_INDEX_URL="https://download.pytorch.org/whl/rocm"