Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build sqlite for risc python installs #70

Merged
merged 16 commits into from
Sep 11, 2024
56 changes: 42 additions & 14 deletions ubuntu-22.04-risc/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,36 +1,64 @@
FROM riscv64/ubuntu:focal as base

Check warning on line 1 in ubuntu-22.04-risc/Dockerfile

View workflow job for this annotation

GitHub Actions / build / package

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN apt-get update && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y build-essential cmake curl wget git make pkg-config libgmp-dev libboost-dev libssl-dev zlib1g zlib1g-dev libreadline-dev libffi-dev && \
DEBIAN_FRONTEND="noninteractive" apt-get install -y tree build-essential cmake curl wget git make pkg-config libgmp-dev libboost-dev libssl-dev zlib1g zlib1g-dev libreadline-dev libffi-dev && \
rm -rf /var/lib/apt/lists/*

FROM base as ld

Check warning on line 7 in ubuntu-22.04-risc/Dockerfile

View workflow job for this annotation

GitHub Actions / build / package

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN curl -L -O https://ftpmirror.gnu.org/gnu/binutils/binutils-2.38.tar.gz && \
tar -xvzf binutils-2.38.tar.gz && \
cd binutils-2.38 && \
./configure --enable-ld --disable-gas --disable-gmp --disable-gold --disable-gprof --prefix=/ld/usr && \
./configure --enable-ld --disable-gas --disable-gmp --disable-gold --disable-gprof --prefix=/opt/ld && \
make && \
make install && \
ls -la /ld/usr/bin && \
ld --version
tree /opt && \
/opt/ld/bin/ld --version

FROM base as sqlite

Check warning on line 18 in ubuntu-22.04-risc/Dockerfile

View workflow job for this annotation

GitHub Actions / build / package

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

RUN curl -L -O https://sqlite.org/2022/sqlite-autoconf-3400100.tar.gz && \
tar -xvzf sqlite-autoconf-3400100.tar.gz && \
cd sqlite-autoconf-3400100 && \
CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=500000" ./configure --prefix=/opt/sqlite3 && \
make && \
make install && \
tree /opt && \
/opt/sqlite3/bin/sqlite3 -version

FROM base as final

Check warning on line 29 in ubuntu-22.04-risc/Dockerfile

View workflow job for this annotation

GitHub Actions / build / package

The 'as' keyword should match the case of the 'from' keyword

FromAsCasing: 'as' and 'FROM' keywords' casing do not match More info: https://docs.docker.com/go/dockerfile/rule/from-as-casing/

COPY --from=ld /ld/usr /usr
RUN ls -la /usr/bin && \
ld --version
COPY --from=ld /opt/ld /usr

COPY --from=sqlite /opt/sqlite3 /opt/sqlite3

RUN tree /opt && \
ld --version && \
/opt/sqlite3/bin/sqlite3 -version

ENV PYENV_ROOT=/root/.pyenv
ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"

RUN curl https://pyenv.run | bash && \
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.8 && \
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.9 && \
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.10 && \
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.11 && \
PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install --skip-existing 3.12 && \
pyenv global 3.12
RUN curl https://pyenv.run | bash

ARG PYTHON_CONFIGURE_OPTS="--enable-shared"
ARG LDFLAGS="-Wl,-rpath,/opt/sqlite3/lib -L/opt/sqlite3/lib -lsqlite3"
ARG CPPFLAGS="-I/opt/sqlite3/include"

RUN pyenv install 3.8
RUN pyenv install 3.9
RUN pyenv install 3.10
RUN pyenv install 3.11
RUN pyenv install 3.12

RUN pyenv global 3.12 3.11 3.10 3.9 3.8

# make sure sqlite is loaded from the expected path
RUN ldd $(python3.8 -c 'import _sqlite3; print(_sqlite3.__file__)') | grep /opt/sqlite3/lib/
RUN ldd $(python3.9 -c 'import _sqlite3; print(_sqlite3.__file__)') | grep /opt/sqlite3/lib/
RUN ldd $(python3.10 -c 'import _sqlite3; print(_sqlite3.__file__)') | grep /opt/sqlite3/lib/
RUN ldd $(python3.11 -c 'import _sqlite3; print(_sqlite3.__file__)') | grep /opt/sqlite3/lib/
RUN ldd $(python3.12 -c 'import _sqlite3; print(_sqlite3.__file__)') | grep /opt/sqlite3/lib/

ENV PATH="/root/.cargo/bin:${PATH}"
ENV RUST_BACKTRACE=1
Expand Down
Loading