Rust bindings in Docker on M1
kakserpom opened this issue · comments
Hey!
What a great project.
Can you please update Rust bindings?
There is no aarch64 image for build_rust
An attempt to build https://github.com/undertheseanlp/underthesea/blob/d8d215943d0b39d525802429a7624b87be128991/extensions/docker/build-image/Dockerfile:
=> ERROR [underthesea 6/27] RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && wget --quiet https://repo.anaconda 27.5s
------
> [underthesea 6/27] RUN echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh && /bin/bash ~/miniconda.sh -b -p /opt/conda && rm ~/miniconda.sh:
24.50 PREFIX=/opt/conda
24.90 installing: python-3.7.0-hc3d631a_0 ...
27.36 rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
27.36 /root/miniconda.sh: line 355: 35 Trace/breakpoint trap "$PREFIX/pkgs/python-3.7.0-hc3d631a_0/bin/python" -E -s "$PREFIX"/pkgs/.install.py $INST_OPT --root-prefix="$PREFIX" --link-dist="$1"
------
failed to solve: process "/bin/sh -c echo 'export PATH=/opt/conda/bin:$PATH' > /etc/profile.d/conda.sh && wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-4.5.11-Linux-x86_64.sh -O ~/miniconda.sh && /bin/bash ~/miniconda.sh -b -p /opt/conda && rm ~/miniconda.sh" did not complete successfully: exit code: 1
@kakserpom Yes, this image is only for building underthesea on Linux. For Mac ARM, we actually use self-hosted GitHub Actions (see https://github.com/undertheseanlp/underthesea/blob/main/.github/workflows/release-pypi-core.yml#L145)
It didn't work on Linux either.
FROM alpine:3.19
ENV PIP_ROOT_USER_ACTION=ignore
# Install required packages
RUN apk add --no-cache \
python3 \
python3-dev \
py3-pip \
curl \
build-base \
pkgconfig \
openssl-dev \
# libressl-dev \
bash \
rust \
cargo \
py3-scikit-learn && \
pip3 install --break-system-packages maturin patchelf
# Install underthesea_core
RUN curl -O
https://files.pythonhosted.org/packages/b3/7f/8d136185263619e25473af7584bb224918a3546975afeb375b87b3bcae20/underthesea_core-1.0.4.tar.gz
&& \
tar -xvf underthesea_core-1.0.4.tar.gz && \
rm underthesea_core-1.0.4.tar.gz && \
cd underthesea_core-1.0.4 && \
maturin build && \
pip3 install --break-system-packages target/wheels/*.whl
# Install underthesea_core
RUN pip install --break-system-packages underthesea
RUN pip install --break-system-packages
https://github.com/kakserpom/fastText/archive/main.zip
COPY server.py .
CMD [ "python3", "server.py"]
Here is a working Dockerfile.
It works on both Linux and Mac.