You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added an installation guide that uses Docker to compile on a Raspberry Pi running Alpine Linux. Since the Alpine package manager is slightly different, I had te figure out which packages were missing in a default installation (namely, bash, make, and patch) and how some of the libraries have different names. I decided to share my (generic) dockerfile with the public, as it may be of help for others (and future me).
In Linux, to make these changes persistent, you may also want to add the :code:`export` lines to your :code:`.bashrc`.
79
+
80
+
Docker installation (optional)
81
+
------------------------------
82
+
83
+
It is also possible to containerize the above build process using Docker. The following dockerfile shows how to build CBC for Python-MIP for an linux/arm/v6 platform (i.e., a Raspberry Pi 2 B). The dockerfile starts from Alpine Linux, which requires slightly different libraries than the Debian libraries above. Depending on your :code:`requirements.txt`, you may need to install additional libraries in the :code:`apk add` command. The dockerfile does not include the optional dependencies of CBC (:code:`libamd2 libcholmod3 libmetis-dev libsuitesparse-dev libnauty2-dev`).
84
+
85
+
.. code-block:: sh
86
+
87
+
# syntax=docker/dockerfile:1
88
+
FROM arm32v6/python:3.7-alpine3.15 AS builder
89
+
RUN apk add --no-cache \
90
+
bash \
91
+
gcc \
92
+
gfortran \
93
+
git \
94
+
g++ \
95
+
libffi-dev \
96
+
libgfortran \
97
+
lapack-dev \
98
+
make \
99
+
patch
100
+
RUN wget https://raw.githubusercontent.com/coin-or/coinbrew/master/coinbrew
101
+
RUN chmod u+x coinbrew
102
+
RUN ./coinbrew fetch Cbc@master
103
+
RUN ./coinbrew build Cbc@master --prefix=/home/haroldo/prog/ --tests=none --enable-cbc-parallel --enable-relocatable
104
+
COPY requirements.txt requirements.txt
105
+
RUN mkdir /pip-install && pip3 install --prefix=/pip-install -r requirements.txt
There are two ways to build this dockerfile. The first option is to build on the same device as where your run the code. In case of the Raspberry Pi, you need a lot of patience (more than 12 hours) to build using the following command:
122
+
123
+
.. code-block:: sh
124
+
125
+
docker build -t <tag>.
126
+
127
+
The second option is to build on a fast device and deploy on another. Most likely, your development machine does not have the linux/arm/v6 architecture, and you require cross-compilation with :code:`buildx`. This option requires an account at `Docker Hub <https://hub.docker.com/>`_. You can run the following to build the code:
0 commit comments