odoo / docker

Other
932 stars 1.52k forks source link

Multiarchitecture support (arm, arm64) #376

Open samip5 opened 3 years ago

samip5 commented 3 years ago

This docker image needs multi-architecture builds so that it can be run on other architecture as well.

llacroix commented 3 years ago

Anything particular is needed for arm support? I wouldn't mind adding arm support to my fork but I have no way to try this out.

samip5 commented 3 years ago

Anything particular is needed for arm support? I wouldn't mind adding arm support to my fork but I have no way to try this out.

Tehnically you only need to make multi-architecture images of it. Google will tell you how it's done.

llacroix commented 3 years ago

From what I could gather, there is no "multi arch" image but more or less multiple images on the same tag through a multi manifest.

It doesn't seem to be possible to easily cross compile an arm image from amd64. So I'd need a VM or an actual device with ARM to build the images myself... Maybe docker hub is smart enough to select a build server on arm based on the docker file. I'll have to try that. Otherwise I just can't seem to build it.

samip5 commented 3 years ago

From what I could gather, there is no "multi arch" image but more or less multiple images on the same tag through a multi manifest.

It doesn't seem to be possible to easily cross compile an arm image from amd64. So I'd need a VM or an actual device with ARM to build the images myself... Maybe docker hub is smart enough to select a build server on arm based on the docker file. I'll have to try that. Otherwise I just can't seem to build it.

Docker hub's automated builder is not smart enough, and thus cannot build other architecture images.

llacroix commented 3 years ago

Hmm but I think my issue is a bit different...

STEP 5: RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
standard_init_linux.go:228: exec user process caused: exec format error
Error: error building at STEP "RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb":
 error while running runtime: exit status 1

I'll have to remove wkhtmltopdf as there are no arm build as far as I know. That said, I do have a wkhtmltopdf server that can be used transparently to point to a remote pdf server... that's a possibility to use as replacement for pdf.

Edit:

There is 0.12.6r1

samip5 commented 3 years ago

Hmm but I think my issue is a bit different...

STEP 5: RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb
standard_init_linux.go:228: exec user process caused: exec format error
Error: error building at STEP "RUN set -x;         apt-get update         && apt-get install -y --no-install-recommends             python3-wheel             python3-setuptools             python3-pip             curl             gnupg             libpq-dev             libsasl2-2             libldap-2.4-2             libxml2             libxmlsec1             libxslt1.1             sudo             node-less         && update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1         && update-alternatives --install /usr/bin/pip pip /usr/bin/pip3 2         && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb         && apt-get install -y --no-install-recommends ./wkhtmltox.deb         && rm -rf /var/lib/apt/lists/* wkhtmltox.deb": error while running runtime: exit status 1

I'll have to remove wkhtmltopdf as there are no arm build as far as I know. That said, I do have a wkhtmltopdf server that can be used transparently to point to a remote pdf server... that's a possibility to use as replacement for pdf.

Umm, it sounds like youre trying to build it incorrectly.

You need to use Docker's buildx functionality most likely.

llacroix commented 3 years ago

Hmm okay, I'll have to update my build script to use buildx but I think it should work transparently. I have a proof of concept that downloads the proper deb file for wkhtmltox. That said It's still unclear what else could go wrong with python deps.

leimantas commented 2 years ago

RUN WKH_VERSION=$([ "$(uname -m)" = 'aarch64' ] && echo "arm64" || echo "amd64") \ && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${WKH_VERSION}.deb

I made this change to original image. And it works.

https://hub.docker.com/r/wbms/odoo14-multiarch

Build command: docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag wbms/odoo14-multiarch:latest .

llacroix commented 2 years ago

I've got some progress on that btw, the only small issue is mainly that for some reasons docker buildx doesnt want to push to a private repository... I haven't figured out why yet but it's also possible to work with other versions than 0.12.6-1

I'm finishing how to improve the version selection of wkhtmltopdf to install and then I think I'll be able to push the docker images in multi arch once I get buildx to push images.

nischi commented 2 years ago

It would be really nice if this is will be in the official image. Is there any plans to do so? We do need it for our developers with MacBook and M1 chips.

ExtremeXBB commented 2 years ago

RUN WKH_VERSION=$([ "$(uname -m)" = 'aarch64' ] && echo "arm64" || echo "amd64") \ && curl -o wkhtmltox.deb -sSL https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.buster_${WKH_VERSION}.deb

I made this change to original image. And it works.

https://hub.docker.com/r/wbms/odoo14-multiarch

Build command: docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag wbms/odoo14-multiarch:latest .

I am using the odoo 15.0, modified the dockerfile similar to this and built it. It works good on my RaspberryPi 4 running with raspios arm64.

sanderkwantes commented 2 years ago

Multi architecture support is also made possible with merge request #399.

gustavovalverde commented 2 years ago

Thanks for this.

I'm using this approach to workaround the wkhtmltopdf: https://github.com/iterativo-git/dockerdoo/blob/13.0/Dockerfile#L55-L61

And building for both platforms using https://github.com/iterativo-git/dockerdoo/blob/13.0/.github/workflows/tests.yaml#L138

derfl0 commented 2 years ago

Let me throw one more option into the ring: separate images for arm ( https://github.com/odoo/docker/pull/410 )

Tested on a M1 and it seems to work

samip5 commented 10 months ago

Let's see if this gets merged: