I am trying to install arduino-cli (a homebrew package) during the docker build, with the following dockerfile.
The docker image seems to build correctly, but when run on my web server, I am getting the following output in my logs.
Note that this problem seems to be similar to Installing homebrew packages during Docker build, but the accepted answer doesn't seem to help me.
Does this seem to indicate that arduino-cli was not installed correctly, or just that the path hasn't been linked correctly?
FileNotFoundError: [Errno 2] No such file or directory: 'arduino-cli': 'arduino-cli'
FROM python:3.6
RUN apt-get update && apt-get install -y git curl binutils clang make
RUN git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew \
&& mkdir ~/.linuxbrew/bin \
&& ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin \
&& eval $(~/.linuxbrew/bin/brew shellenv) \
&& brew --version \
&& brew install arduino-cli \
&& arduino-cli version
ENV PATH=~/.linuxbrew/bin:~/.linuxbrew/sbin:$PATH
RUN mkdir -p /opt/services/djangoapp/src
WORKDIR /opt/services/djangoapp/src
RUN pip install gunicorn django psycopg2-binary whitenoise
COPY . /opt/services/djangoapp/src
EXPOSE 8000
COPY init.sh /usr/local/bin/
RUN chmod u+x /usr/local/bin/init.sh
ENTRYPOINT ["init.sh"]
It's most likely the $PATH problem. The reason why the mentioned answer did not work for you is that you are trying to use arduino-cli when $PATH is not yet changed. This should make it work:
RUN git clone https://github.com/Homebrew/brew ~/.linuxbrew/Homebrew \
&& mkdir ~/.linuxbrew/bin \
&& ln -s ../Homebrew/bin/brew ~/.linuxbrew/bin \
&& eval $(~/.linuxbrew/bin/brew shellenv) \
&& brew --version \
&& brew install arduino-cli
# first change PATH
ENV PATH=~/.linuxbrew/bin:~/.linuxbrew/sbin:$PATH
# then run
RUN arduino-cli version
# not vice-versa
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With