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

Add s390x support to docker images #208

Closed
kun-lu20 opened this issue Jun 2, 2022 · 9 comments
Closed

Add s390x support to docker images #208

kun-lu20 opened this issue Jun 2, 2022 · 9 comments

Comments

@kun-lu20
Copy link

kun-lu20 commented Jun 2, 2022

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
Copy link
Member

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
Copy link
Author

kun-lu20 commented Jun 2, 2022

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
Copy link
Author

kun-lu20 commented Jun 2, 2022

@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
Copy link
Member

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:
zherczeg/sljit#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
Copy link
Author

kun-lu20 commented Jun 2, 2022

@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 added a commit that referenced this issue Jun 2, 2022
Flavors:  alpine, alpine-fat, bionic, focal/jammy

Build-from-source Dockfiles now have more custom PCRE build options
as s390x does not support PCRE JIT.  So we disable it in s390x builds.
@neomantra
Copy link
Member

neomantra commented Jun 2, 2022

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
Copy link
Author

kun-lu20 commented Jun 2, 2022

@neomantra I see. Thank you very much!

@neomantra
Copy link
Member

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

  • openresty/openresty:1.21.4.1-1-bionic
  • openresty/openresty:1.21.4.1-1-focal
  • openresty/openresty:1.21.4.1-1-jammy

Have fun!

@kun-lu20
Copy link
Author

kun-lu20 commented Jun 3, 2022

Great! Thanks again @neomantra

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants