emosenkis / esp-rs

Script for installing/running toolchain for building ESP8266 firmware in Rust
MIT License
329 stars 19 forks source link

Dockerfile fails to build #19

Closed alsuren closed 5 years ago

alsuren commented 6 years ago

It looks like it does the compiling of mrustc fine, but then explodes trying to find platformio.

cp output/rustc-build/rustc output/
Cloning into '/root/.esp-rs/esp8266-arduino'...
Installing PlatformIO ESP8266 Arduino SDK...
./build.sh: line 72: platformio: command not found
The command '/bin/sh -c ./build.sh --install' returned a non-zero code: 127

(full log here: esp-rs.docker.log )

This is on docker-for-mac:

$ docker --version
Docker version 18.06.0-ce, build 0ffa825

linuxkit-025000000001:~# uname -a
Linux linuxkit-025000000001 4.9.93-linuxkit-aufs #1 SMP Wed Jun 6 16:55:56 UTC 2018 x86_64 Linux

I suspect that PATH is not being set up correctly, but I'm not completely sure which step it's failing at.

To get a quick reproduction of this problem, I copied the platformio installation to the top of the function, and added a sanity check immediately afterwards, using this patch:

diff --git a/Dockerfile b/Dockerfile
index d3debb1..64f5bfe 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -7,7 +7,7 @@ ENV PATH="/root/.cargo/bin:${PATH}"

 WORKDIR /build

-RUN git clone https://github.com/emosenkis/esp-rs
+COPY . esp-rs

 WORKDIR /build/esp-rs

diff --git a/build.sh b/build.sh
index bbb7770..0f66df6 100755
--- a/build.sh
+++ b/build.sh
@@ -34,6 +34,13 @@ function main() {
 }

 function install_toolchain() {
+
+    if ! platformio --version &>/dev/null; then
+        echo 'Installing platformio...'
+        pip install platformio --user
+        platformio --version
+    fi
+    
     if ! rustup --version &>/dev/null; then
         echo 'Installing rustup...'
         curl https://sh.rustup.rs -sSf | sh

The PATH is /root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

Once this builds, it would be useful to upload it to docker hub and link to it from the README, because it takes ages.

emosenkis commented 5 years ago

@antonok-edm

antonok-edm commented 5 years ago

@emosenkis @alsuren The latest commit broke the build. Fixed in #22.

antonok-edm commented 5 years ago

@emosenkis this can be closed now that #22 is merged.