Build Dockerfile on Pi OS
brenner-tobias opened this issue · 4 comments
I am trying to build the Dockerfile locally to test some chages. On my Mac it is working fine, unfortunately it is not on Pi OS, I ran into an error:
docker build -t ha-cloudflared .
Sending build context to Docker daemon 87.04kB
Step 1/17 : ARG GOVERSION=1.17.3
Step 2/17 : FROM --platform=${BUILDPLATFORM} golang:$GOVERSION-alpine AS build`
failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument
I am not sure if this is a specific problem of your Dockerfile or if this is a general docker build
problem, which leads to the variable BUILDPLATFORM
being empty.
Any idea?
Hi!
First a quick note that building isn't required unless you feel its necessary, the automatically built erisamoe/cloudflared
or ghcr.io/erisa/cloudflared
will work on any platform including all Pis.
The error you get is because Docker Buildx is required to build. (https://docs.docker.com/buildx/working-with-buildx/)
The correct command would instead be docker buildx build .
and if it isn't present you might have to install it.
It works on your Mac because Docker Desktop uses buildx by default :)
Ignore the close, pressed "Close with comment" by accident while trying to select text on my phone haha
Thanks a lot for your super fast and detailed response. I know that running your built container works, I am just thinking about modifying the Dockerfile to be used as an Home Assistant Add-On at some point.
Regarding the command thanks for the clarification. I actually already tried docker buildx build .
as well, but I ran into another problem, since Docker is for some reason not able to fetch the apk packages:
[build 3/5] RUN apk --no-cache add git build-base:
#6 0.673 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/armv7/APKINDEX.tar.gz
#6 0.735 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/main: temporary error (try again later)
#6 0.735 fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/armv7/APKINDEX.tar.gz
#6 0.737 WARNING: Ignoring https://dl-cdn.alpinelinux.org/alpine/v3.14/community: temporary error (try again later)
#6 0.737 ERROR: unable to select packages:
#6 0.739 build-base (no such package):
#6 0.739 required by: world[build-base]
#6 0.739 git (no such package):
#6 0.739 required by: world[git]
Since this looks like an issue with my build not having a proper connection to the packages and not related to your development at all, I will close this ticket and do some research on this.
Thanks a lot in advance for your help.
P.S. If you are interested in Home Assistant, I would be happy to work on the add-on together, though I am still in a super early stage...
That does indeed look like an environment issue! If i were me I'd try running an interactive container (docker run -it alpine
) and debug from there.
Unfortunately I have no interest in Home Assistant, but I'm happy you're making something great and I'd love to see how it goes!