openresty / docker-openresty

Docker tooling for OpenResty
https://hub.docker.com/r/openresty/openresty
BSD 2-Clause "Simplified" License
935 stars 525 forks source link

Add s390x support to docker images #208

Closed kun-lu20 closed 2 years ago

kun-lu20 commented 2 years ago

Hi,

Since OpenResty could be built from source on s390x with similar steps to amd64 arch now, and Travis CI has s390x support as well, we would greatly appreciate it if community can provide official s390x docker images.

The existing Dockerfiles need to be adjusted slightly to exclude PCRE build steps which do not support s390x yet. If community agrees to add s390x to "build-from-source" flavors, I can raise a PR to add Dockerfiles for s390x.

Thanks!

neomantra commented 2 years ago

I have the Travis CI aspect of it done -- it was straight forward as I made the tooling generic, so it was easy.

Can you paste a diff you needed for one of the Dockerfiles so I can follow it? I don't have anything to build on to test locally. But I will push to a test CI/CD branch.

kun-lu20 commented 2 years ago

Thanks @neomantra !

Sure, below is the diff log for the Ubuntu focal Dockerfile:

diff --git a/focal/Dockerfile b/focal/Dockerfile
index b5d0879..975e90f 100644
--- a/focal/Dockerfile
+++ b/focal/Dockerfile
@@ -94,6 +94,7 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
         libperl-dev \
         libreadline-dev \
         libxslt1-dev \
+        libpcre3-dev \
         make \
         perl \
         unzip \
@@ -124,19 +125,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
     && make -j${RESTY_J} \
     && make -j${RESTY_J} install_sw \
     && cd /tmp \
-    && curl -fSL https://downloads.sourceforge.net/project/pcre/pcre/${RESTY_PCRE_VERSION}/pcre-${RESTY_PCRE_VERSION}.tar.gz -o pcre-${RESTY_PCRE_VERSION}.tar.gz \
-    && echo "${RESTY_PCRE_SHA256}  pcre-${RESTY_PCRE_VERSION}.tar.gz" | shasum -a 256 --check \
-    && tar xzf pcre-${RESTY_PCRE_VERSION}.tar.gz \
-    && cd /tmp/pcre-${RESTY_PCRE_VERSION} \
-    && ./configure \
-        --prefix=/usr/local/openresty/pcre \
-        --disable-cpp \
-        --enable-jit \
-        --enable-utf \
-        --enable-unicode-properties \
-    && make -j${RESTY_J} \
-    && make -j${RESTY_J} install \
-    && cd /tmp \
     && curl -fSL https://openresty.org/download/openresty-${RESTY_VERSION}.tar.gz -o openresty-${RESTY_VERSION}.tar.gz \
     && tar xzf openresty-${RESTY_VERSION}.tar.gz \
     && cd /tmp/openresty-${RESTY_VERSION} \
@@ -146,7 +134,6 @@ RUN DEBIAN_FRONTEND=noninteractive apt-get update \
     && cd /tmp \
     && rm -rf \
         openssl-${RESTY_OPENSSL_VERSION}.tar.gz openssl-${RESTY_OPENSSL_VERSION} \
-        pcre-${RESTY_PCRE_VERSION}.tar.gz pcre-${RESTY_PCRE_VERSION} \
         openresty-${RESTY_VERSION}.tar.gz openresty-${RESTY_VERSION} \
     && curl -fSL https://luarocks.github.io/luarocks/releases/luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz -o luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
     && tar xzf luarocks-${RESTY_LUAROCKS_VERSION}.tar.gz \
kun-lu20 commented 2 years ago

@neomantra I've tested the built s390x image locally. Please feel free to let me know if you also need s390x VMs for building and testing. Thank you!

neomantra commented 2 years ago

I just got an IBM Cloud s390x VM on the free tier -- I should be fine for a bit.

I see that PCRE is not building because its JIT is not supported on s390x ? I was looking at the Ubuntu version and I think they simply build it without JIT support? It's clear that's what is happening in Alpine.

It seems there is discussion about this: https://github.com/zherczeg/sljit/issues/89

All of this affect the upstream ticket too.

So I will not take your approach of using the system PCRE, but rather modify the Dockerfiles to accept JIT-less PCRE build and note it in the README.

kun-lu20 commented 2 years ago

@neomantra Yes, JIT in PCRE is not supported on s390x yet. Thanks for the detailed info!

Sure, disabling the --enable-jit option when building PCRE also works. I just tested it locally.

neomantra commented 2 years ago

Seems that there's some issue with Alpine builds. It works if you build the image on bare metal or a VM, but it is not working on Travis Docker-in-Docker environment. I've had image build issues like this before regarding Alpine and they are not very tractable.

So I'm going to omit Alpine for now.

kun-lu20 commented 2 years ago

@neomantra I see. Thank you very much!

neomantra commented 2 years ago

This is released on built-from-source Ubuntu flavors:

Have fun!

kun-lu20 commented 2 years ago

Great! Thanks again @neomantra