Skip to content

Commit

Permalink
Update sqlite and ssl (#90)
Browse files Browse the repository at this point in the history
* Update sqlite and ssl

* don't need to specify libssl3

* Update to alpine 3.21 which uses openssl 3

* Remove python 3.8

* Try to compile and use openssl 3.0.15

* Fixup typo

* Add in CONFIGURE_OPTS

* pyenv build adjustments

* Some more updates

* handle either lib or lib64?

* force openssl to use lib dir to simplify pyenv build

* remove unneeded items from openssl

* Adjust some more config options based on documentation

* Try qemu-cache-optional for riscv

* Switch back to main
  • Loading branch information
emlowe authored Jan 14, 2025
1 parent 20d4f8b commit 5bfe33c
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 50 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build-ubuntu-22.04-risc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ jobs:
build:
uses: Chia-Network/actions/.github/workflows/docker-build.yaml@main
with:
enable-qemu-cache: false
alternate-latest-mode: true
runs-on: k8s-public
timeout-minutes: 240
Expand Down
10 changes: 2 additions & 8 deletions alpine/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM alpine:3.16.2
FROM alpine:3.21
WORKDIR /root

# Set environment variables for rust and pyenv
Expand All @@ -7,21 +7,15 @@ ENV PATH="$PYENV_ROOT/shims:$PYENV_ROOT/bin:$PATH"
ENV PATH="/root/.cargo/bin:${PATH}"
ENV RUST_BACKTRACE=1

RUN sh -c "echo https://mirrors.edge.kernel.org/alpine/v3.16.2/community >> /etc/apk/repositories"
RUN apk add bash git curl python3 openssl openssl-dev perl linux-headers make gcc musl-dev patch patchelf
RUN apk add bash git curl python3 openssl openssl-dev perl linux-headers make gcc musl-dev patch patchelf py3-pip
# Additional pyenv dependencies
RUN apk add --no-cache build-base libffi-dev bzip2-dev zlib-dev xz-dev readline-dev sqlite-dev tk-dev

# Install Rust
RUN curl --proto '=https' --tlsv1.2 -sSf -o rustup https://sh.rustup.rs
RUN sh ./rustup -y

# Build a copy of openssl - needed for the rust-openssl crate
COPY build-openssl.sh .
RUN sh ./build-openssl.sh

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 && \
Expand Down
16 changes: 0 additions & 16 deletions alpine/build-openssl.sh

This file was deleted.

28 changes: 21 additions & 7 deletions rocky8/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,39 @@ RUN yum -y groupinstall "Development Tools" && \

# Compile newer version of sqlite3
RUN cd ~ && \
wget -q https://sqlite.org/2022/sqlite-autoconf-3400100.tar.gz && \
tar -xzf sqlite-autoconf-3400100.tar.gz && \
cd sqlite-autoconf-3400100 && \
wget -q https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz && \
tar -xzf sqlite-autoconf-3450100.tar.gz && \
cd sqlite-autoconf-3450100 && \
CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=500000" ./configure --prefix=/usr/sqlite3 && \
make && \
make install && \
cd ~ && \
rm -rf ~/sqlite-autoconf*

# Compile newer version of openssl \
RUN cd ~ && \
yum -y install perl-IPC-Cmd perl-Pod-Html && \
wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.15/openssl-3.0.15.tar.gz && \
tar -xzf openssl-3.0.15.tar.gz && \
cd openssl-3.0.15 && \
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl --libdir=lib no-ssl3 no-idea no-dtls no-srp no-comp shared && \
make && \
make install && \
cd ~ && \
rm -rf ~/openssl-3.0.15*

# Compile newer version of python3
RUN yum -y install openssl openssl-devel zlib-devel bzip2 bzip2-devel readline-devel tk-devel libffi-devel xz-devel && \
RUN yum -y install zlib-devel bzip2 bzip2-devel readline-devel tk-devel libffi-devel xz-devel && \
cd ~ && \
# Set up pyenv \
export PYTHON_CONFIGURE_OPTS="--with-openssl=/usr/local/ssl --with-openssl-rpath=auto --enable-shared --enable-optimizations" && \
git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \
pyenv install 3.10 && \
pyenv global 3.10 && \
pyenv install 3.11 --verbose && \
pyenv global 3.11 && \
pip install --upgrade pip && \
pip install --no-cache-dir py3createtorrent awscli && \
python3 -c 'import sys; import sqlite3; sys.exit(sqlite3.sqlite_version != "3.40.1")' && \
python3 -c 'import sys; import sqlite3; sys.exit(sqlite3.sqlite_version != "3.45.1")' && \
python3 -c 'import sys; import ssl; sys.exit(ssl.OPENSSL_VERSION_INFO != (3,0,0,15,0))' && \
yum clean all

# Add nodejs
Expand Down
29 changes: 22 additions & 7 deletions ubuntu-20.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,42 @@ RUN apt-get update && \
vim \
wget \
xz-utils \
zlib1g-dev && \
zlib1g-dev \
checkinstall && \
rm -rf /var/lib/apt/lists/*

# Compile newer version of sqlite3 \
RUN cd ~ && \
wget -q https://sqlite.org/2022/sqlite-autoconf-3400100.tar.gz && \
tar -xzf sqlite-autoconf-3400100.tar.gz && \
cd sqlite-autoconf-3400100 && \
wget -q https://www.sqlite.org/2024/sqlite-autoconf-3450100.tar.gz && \
tar -xzf sqlite-autoconf-3450100.tar.gz && \
cd sqlite-autoconf-3450100 && \
CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=500000" ./configure --prefix=/usr && \
make && \
make install && \
cd ~ && \
rm -rf ~/sqlite-autoconf*

# Compile newer version of openssl \
RUN cd ~ && \
wget -q https://github.com/openssl/openssl/releases/download/openssl-3.0.15/openssl-3.0.15.tar.gz && \
tar -xzf openssl-3.0.15.tar.gz && \
cd openssl-3.0.15 && \
./config --prefix=/usr/local/ssl --openssldir=/usr/local/ssl --libdir=lib no-ssl3 no-idea no-dtls no-srp no-comp shared && \
make && \
make install && \
cd ~ && \
rm -rf ~/openssl-3.0.15*

# Set up pyenv \
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \
pyenv install 3.10 && \
pyenv global 3.10 && \
export PYTHON_CONFIGURE_OPTS="--with-openssl=/usr/local/ssl --with-openssl-rpath=auto --enable-shared --enable-optimizations" && \
pyenv install 3.11 --verbose && \
pyenv global 3.11 && \
pip install --upgrade pip && \
pip install --no-cache-dir py3createtorrent && \
python3 -c 'import sys; import sqlite3; sys.exit(sqlite3.sqlite_version != "3.40.1")'
python3 -c 'import sys; import sqlite3; sys.exit(sqlite3.sqlite_version != "3.45.1")' && \
python3 -c 'import sys; import ssl; sys.exit(ssl.OPENSSL_VERSION_INFO != (3,0,0,15,0))'


# Add nodejs
ENV NODE_MAJOR=18
Expand Down
10 changes: 4 additions & 6 deletions ubuntu-22.04-risc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ RUN curl -L -O https://ftpmirror.gnu.org/gnu/binutils/binutils-2.38.tar.gz && \

FROM base AS sqlite

RUN curl -L -O https://sqlite.org/2022/sqlite-autoconf-3400100.tar.gz && \
tar -xvzf sqlite-autoconf-3400100.tar.gz && \
cd sqlite-autoconf-3400100 && \
RUN curl -L -O https://sqlite.org/2024/sqlite-autoconf-3450100.tar.gz && \
tar -xvzf sqlite-autoconf-3450100.tar.gz && \
cd sqlite-autoconf-3450100 && \
CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=500000" ./configure --prefix=/opt/sqlite3 && \
make && \
make install && \
Expand All @@ -46,16 +46,14 @@ 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
RUN pyenv global 3.12 3.11 3.10 3.9

# 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/
Expand Down
13 changes: 7 additions & 6 deletions ubuntu-22.04/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ RUN apt-get update && \

# Compile newer version of sqlite3 \
RUN cd ~ && \
wget -q https://sqlite.org/2022/sqlite-autoconf-3400100.tar.gz && \
tar -xzf sqlite-autoconf-3400100.tar.gz && \
cd sqlite-autoconf-3400100 && \
wget -q https://sqlite.org/2024/sqlite-autoconf-3450100.tar.gz && \
tar -xzf sqlite-autoconf-3450100.tar.gz && \
cd sqlite-autoconf-3450100 && \
CFLAGS="-DSQLITE_MAX_VARIABLE_NUMBER=500000" ./configure --prefix=/usr && \
make && \
make install && \
Expand All @@ -58,11 +58,12 @@ RUN cd ~ && \

# Set up pyenv
RUN git clone https://github.com/pyenv/pyenv.git ~/.pyenv && \
pyenv install 3.10 && \
pyenv global 3.10 && \
export PYTHON_CONFIGURE_OPTS="--enable-shared --enable-optimizations" && \
pyenv install 3.11 --verbose && \
pyenv global 3.11 && \
pip install --upgrade pip && \
pip install --no-cache-dir py3createtorrent && \
python3 -c 'import sys; import sqlite3; sys.exit(sqlite3.sqlite_version != "3.40.1")'
python3 -c 'import sys; import sqlite3; sys.exit(sqlite3.sqlite_version != "3.45.1")'

# Add nodejs
ENV NODE_MAJOR=18
Expand Down

0 comments on commit 5bfe33c

Please sign in to comment.