Skip to content

Commit c1a7966

Browse files
committed
Install common Python packages
1 parent 78bacc8 commit c1a7966

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Dockerfile

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM ubuntu
22

33
RUN <<EOF
44
apt-get update
5-
apt-get install -y curl build-essential python3 git cmake pkg-config busybox
5+
apt-get install -y curl build-essential python3-pip git cmake pkg-config busybox
66
EOF
77

88
ARG TARGETARCH
@@ -15,6 +15,8 @@ ENV WASMTIME_VERSION=26.0.0
1515
ENV WIZER_VERSION=7.0.5
1616
ENV WASI_VFS_VERSION=0.5.4
1717
ENV PYTHON_PATH=/opt/wasi-python
18+
ENV PYTHON_PYLIB=${PYTHON_PATH}/lib/python3.13
19+
ENV PYTHON_SITE=${PYTHON_PYLIB}/site-packages
1820

1921
RUN <<EOF
2022
mkdir ${WASI_SDK_PATH}
@@ -98,9 +100,21 @@ AR
98100
EOF
99101

100102
RUN <<EOF
101-
cd ${PYTHON_PATH}/lib/python3.13
103+
cd ${PYTHON_PYLIB}
102104
find . -name __pycache__ -exec rm -rf {} \;
103105
rm -rf config-3.13-wasm32-wasi
104106
rm -rf _*_support* _pyrepl bdb ensurepip doctest* idlelib pdb pydoc*
105107
rm -rf sqlite3 ssl* subprocess* tkinter turtle* venv webbrowser*
106108
EOF
109+
110+
RUN pip3 install --target ${PYTHON_SITE} \
111+
--no-compile --platform wasi-wasm32 --only-binary :all: \
112+
attrs bleach charset-normalizer defusedxml idna jmespath jsonschema \
113+
pyasn1 pyparsing python-dateutil rsa tomli ua-parser
114+
115+
RUN <<EOF
116+
cd ${PYTHON_SITE}
117+
find . -name '*.dist-info' -exec rm -rf {} \;
118+
rm -rf bin
119+
/build/cpython/cross-build/build/python -m compileall -b .
120+
EOF

0 commit comments

Comments
 (0)