Error during build: Platform 'arduino:avr' not found in GCP

I am Running a docker node application on GCP. I have defined the docker file as following

FROM alpine:latest
    
    RUN apk update
    RUN apk upgrade
    
    RUN apk add curl
    RUN apk add --no-cache libstdc++ gcompat
    RUN apk add --update nodejs npm
    RUN curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
    
    
    RUN arduino-cli core update-index
    RUN arduino-cli core install arduino:avr
    
    WORKDIR /usr/src/app
    
    COPY package*.json ./
    RUN npm install
    
    COPY . .
    EXPOSE 8080
    CMD [ "npm", "start" ]

During the build in docker registy the CLI clearly shows that arduino:avr gets installed.

Step 8/15 : RUN arduino-cli core update-index
     Running in bd32bf6755bf
    Downloading index: library_index.json.gz downloaded
    Downloading index signature: library_index.json.sig downloaded
    Downloading index: package_index.tar.bz2 downloaded
    Downloading index: package_index.tar.bz2 downloaded
    Removing intermediate container bd32bf6755bf
     daec699a0fa9
    Step 9/15 : RUN arduino-cli core install arduino:avr
     Running in 33b18d291106
    Downloading missing tool builtin:ctags@5.8-arduino11...
    builtin:ctags@5.8-arduino11 downloaded
    Installing builtin:ctags@5.8-arduino11...
    builtin:ctags@5.8-arduino11 installed
    Downloading missing tool builtin:serial-discovery@1.3.2...
    builtin:serial-discovery@1.3.2 downloaded
    Installing builtin:serial-discovery@1.3.2...
    builtin:serial-discovery@1.3.2 installed
    Downloading missing tool builtin:mdns-discovery@1.0.6...
    builtin:mdns-discovery@1.0.6 downloaded
    Installing builtin:mdns-discovery@1.0.6...
    builtin:mdns-discovery@1.0.6 installed
    Downloading missing tool builtin:serial-monitor@0.9.1...
    builtin:serial-monitor@0.9.1 downloaded
    Installing builtin:serial-monitor@0.9.1...
    builtin:serial-monitor@0.9.1 installed
    Downloading packages...
    arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7 downloaded/ 35.89 MiB   49.96%
    arduino:avrdude@6.3.0-arduino17 downloaded
    arduino:arduinoOTA@1.3.0 downloaded
    arduino:avr@1.8.5 downloaded
    Installing arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7...
    arduino:avr-gcc@7.3.0-atmel3.6.1-arduino7 installed
    Installing arduino:avrdude@6.3.0-arduino17...
    arduino:avrdude@6.3.0-arduino17 installed
    Installing arduino:arduinoOTA@1.3.0...
    arduino:arduinoOTA@1.3.0 installed
    Installing platform arduino:avr@1.8.5...
    Skipping platform configuration....
    Platform arduino:avr@1.8.5 installed
    Removing intermediate container 33b18d291106
     f762d52d4b9b

But when I try to run a POST request I get an error saying that arduino:avr is not found

curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $(gcloud auth print-identity-token)" -d "{\"sketch\":\"// LEDs connected to pins 5\n\nvoid setup() {\n  pinMode(5, OUTPUT);\n}\n\nvoid loop() {\n  digitalWrite(5, HIGH);\n  delay(250);\n  digitalWrite(5, LOW);\n  delay(250);\n}\"}" $(echo $SERVICE_URL)
    {"stdout":"","stderr":"Error during build: Platform 'arduino:avr' not found: platform not installed\nTry running `arduino-cli core install arduino:avr`\n","hex":"","eep":""}

I've tried running the app locally on my pc as well as on gcloud and it works flawlessly.

Thanks in advance.

The AVR platform is installed in the Arduino CLI data directory, maybe this directory is missing?

The default path is $HOME/.arduino15, you must ensure that this directory is included in the container build.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.