I had to install python in an air gap network so I couldn't run apk add
. Here's how I got required packages inside an online alpine container:
apk fetch python3 py3-pip libbz2 libexpat libffi gdbm mpdecimal libpanelw readline \
sqlite-libs py3-setuptools libgcc libstdc++ py3-packaging py3-parsing
And my Dockerfile looks like this:
ENV PYTHONUNBUFFERED=1
COPY ./*.apk .
RUN apk add --allow-untrusted --no-network libgcc* libstdc++* gdbm* libbz2* \
libexpat* libffi* libpanel* mpdecimal* \
readline* sqlite* \
python3-3.11.4-r0.apk py3-parsing* py3-packaging* py3-setuptools* py3-pip-23.1.2-r0.apk && \
rm *.apk && \
ln -sf python3 /usr/bin/python
And the dependency hell got resolved.