element-hq / dendrite

Dendrite is a second-generation Matrix homeserver written in Go!
https://element-hq.github.io/dendrite/
GNU Affero General Public License v3.0
33 stars 5 forks source link

`docker build` fails on macOS + colima #3370

Open matrixbot opened 2 weeks ago

matrixbot commented 2 weeks ago

This issue was originally created by @Amar1729 at https://github.com/matrix-org/dendrite/issues/3370.

Background information

Description

Steps to reproduce

~/Documents/matrix/dendrite $ colima version
colima version 0.6.8
git commit: 9b0809d0ed9ad3ff1e57c405f27324e6298ca04f

runtime: docker
arch: aarch64
client: v26.1.1
server: v24.0.9

~/Documents/matrix/dendrite $ docker build -t matrixdotorg/dendrite-monolith .
DEPRECATED: The legacy builder is deprecated and will be removed in a future release.
            Install the buildx component to build images with BuildKit:
            https://docs.docker.com/go/buildx/

Sending build context to Docker daemon  64.91MB
Step 1/23 : FROM --platform=${BUILDPLATFORM} docker.io/golang:1.21-alpine3.18 AS base
failed to parse platform : "" is an invalid component of "": platform specifier component must match "^[A-Za-z0-9_-]+$": invalid argument

However, there's a workaround: ssh into colima's VM, and then issue docker build from there.

$ colima ssh
amar@colima:/Users/amar/Documents/matrix/dendrite$ docker build -t matrixdotorg/dendrite-monolith .

<builds as expected>

I have deleted + re-initialized the colima VM to ensure i was building from a clean slate. I think that this actually might be some kind of an issue with how colima is setting certain variables, or communicating with the docker client. Since I figured out a workaround, i thought I would post it here in case anybody runs into the same issue (but I'm not yet sure why exactly this is happening?).

I did try docker build with --platform arm64 (and others) based on the error message, but that didn't result in anything different.