Skip to content

Commit

Permalink
simplify + run as root in docker
Browse files Browse the repository at this point in the history
  • Loading branch information
bjia56 committed Aug 7, 2024
1 parent dba4e92 commit 18450f8
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions scripts/repackage_graalpy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,18 @@ if [[ "${PLATFORM}" != "windows" ]]; then
source venv/bin/activate
fi

if [[ "${PLATFORM}" == "linux" ]]; then
docker pull "${DOCKER_IMAGE}"
function maybe_docker () {
docker run -v .:/ws --workdir /ws "${DOCKER_IMAGE}" "$@"
sudo chown -R $(id -u):$(id -g) .
}
else
function maybe_docker () {
"$@"
}
fi

python3 -m pip install pyclean
WORKDIR=$(pwd)

Expand Down Expand Up @@ -58,24 +70,12 @@ function repackage_graal () {
cd ${EXTRACTED_FILENAME}
if [[ "${DISTRIBUTION}" == *"jvm"* ]]; then
if [[ "${DISTRIBUTION}" == *"community"* ]]; then
if [[ "${PLATFORM}" == "linux" ]]; then
docker run -v .:/ws --workdir /ws --user $(id -u):$(id -g) "${DOCKER_IMAGE}" ./libexec/graalpy-polyglot-get js-community
else
./libexec/graalpy-polyglot-get js-community
fi
maybe_docker ./libexec/graalpy-polyglot-get js-community
else
if [[ "${PLATFORM}" == "linux" ]]; then
docker run -v .:/ws --workdir /ws --user $(id -u):$(id -g) "${DOCKER_IMAGE}" ./libexec/graalpy-polyglot-get js
else
./libexec/graalpy-polyglot-get js
fi
maybe_docker ./libexec/graalpy-polyglot-get js
fi
fi
if [[ "${PLATFORM}" == "linux" ]]; then
docker run -v .:/ws --workdir /ws --user $(id -u):$(id -g) "${DOCKER_IMAGE}" ./bin/python -m ensurepip
else
./bin/python -m ensurepip
fi
maybe_docker ./bin/python -m ensurepip

cd ${WORKDIR}
if [[ "${EXTRACTED_FILENAME}" != "${UPLOAD_FILENAME}" ]]; then
Expand Down

0 comments on commit 18450f8

Please sign in to comment.