File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 88# INSTALL SERVER
99pip install pypiserver
1010
11- # CREATE/DOWNLOADING
11+ # CREATE/DOWNLOADING / # OPTION1: DOWNLOAD PIP PACKAGES MANUALY
1212mkdir ~ /packages
1313pip download requests -d ~ /packages
1414pip download picker==2.3.0 -d ~ /packages
@@ -20,6 +20,50 @@ pypi-server run -p 8080 ~/package
2020pip install --index-url http://localhost:8080/simple picker
2121```
2222
23+ ``` bash
24+ # OPTION2: DOWNLOAD PIP PACKAGES w/ DOCKER
25+
26+ cat << EOF > pip-schleuser.sh
27+ #!/bin/sh
28+ set -eux
29+
30+ BASE_IMAGE=$1
31+ PIP_PACKAGES=$2
32+
33+ # Local directory on host
34+ WHEELHOUSE="$( pwd) /wheelhouse"
35+ mkdir -p "$WHEELHOUSE "
36+
37+ # Run container to build offline wheelhouse
38+ docker run --rm -it \
39+ -v "$WHEELHOUSE :/wheelhouse" \
40+ "$BASE_IMAGE " sh -euxc "
41+
42+ # 1. Create and activate venv
43+ python3 -m venv /venv
44+ . /venv/bin/activate
45+
46+ # 2. Upgrade pip tooling
47+ pip install --upgrade pip setuptools wheel
48+
49+ # 3. Download requested packages into /wheelhouse
50+ pip download -d /wheelhouse $PIP_PACKAGES
51+
52+ # 4. Optional: install them (from wheelhouse, offline style)
53+ pip install --no-index --find-links=/wheelhouse $PIP_PACKAGES
54+
55+ # 5. Record installed packages
56+ pip freeze > /wheelhouse/installed-packages.txt
57+ "
58+
59+ echo "[INFO] pip packages and wheelhouse saved under: $WHEELHOUSE "
60+
61+ zip -r ./pip-packages.zip wheelhouse
62+ EOF
63+
64+ sh pip-schleuser.sh python:3.10.0-alpine " requests flask"
65+ ```
66+
2367``` yaml
2468# DEPLOY ON KUBERNETES
2569---
You can’t perform that action at this time.
0 commit comments