speedtest-exporter
speedtest-exporter copied to clipboard
Build and release for arm7
I love your projects @caarlos0 . Currently, I'm setting up my raspi, however, I get the error
Failed to pull image "ghcr.io/caarlos0/speedtest-exporter:v1.1.4": rpc error: code = NotFound desc = failed to pull and unpack image "ghcr.io/caarlos0/speedtest-exporter:v1.1.4": no match for platform in manifest: not found
and arch
gives me armv7l
. AFAICS you are using a general file https://github.com/caarlos0/goreleaserfiles/blob/main/docker.yml, so you might know best how to extend it properly because the effect might then be bigger.
Best Manuel
I tried it out locally and got it working by
- adapting the
Dockerfile
FROM alpine
EXPOSE 9876
ARG ARCH
WORKDIR /
RUN wget -O /tmp/speedtest.tgz "https://install.speedtest.net/app/cli/ookla-speedtest-1.0.0-${ARCH}-linux.tgz" && \
tar xvfz /tmp/speedtest.tgz -C /usr/local/bin speedtest && \
rm -rf /tmp/speedtest.tgz
COPY speedtest-exporter*.apk /tmp
RUN apk add --allow-untrusted /tmp/speedtest-exporter*.apk
ENTRYPOINT ["/usr/local/bin/speedtest-exporter"]
- and also passing in a
build-arg
and making a separateimage_templates
block as a list of platforms are not supported (see https://github.com/docker/buildx/issues/59) and also in goreleaser the--load
is hard-wired (see here) which cannot be combined with--push
, which is needed for the lists. So I ended up doing it as follows:
dockers:
- image_templates:
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-amd64'
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/caarlos0/{{ .ProjectName }}"
- "--platform=linux/amd64"
- "--build-arg=ARCH=x86_64" # <-- here for the speedtest binary download
- image_templates:
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-arm64'
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/caarlos0/{{ .ProjectName }}"
- "--platform=linux/arm64"
- "--build-arg=ARCH=aarch64" # <-- here for the speedtest binary download
goarch: arm64
- image_templates:
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-armv7'
dockerfile: Dockerfile
use: buildx
build_flag_templates:
- "--pull"
- "--label=org.opencontainers.image.created={{.Date}}"
- "--label=org.opencontainers.image.name={{.ProjectName}}"
- "--label=org.opencontainers.image.revision={{.FullCommit}}"
- "--label=org.opencontainers.image.version={{.Version}}"
- "--label=org.opencontainers.image.source=https://github.com/caarlos0/{{ .ProjectName }}"
- "--platform=linux/arm/v7" # <-- and building for armv7
- "--build-arg=ARCH=aarch64" # <-- here for the speedtest binary download
goarch: arm64
docker_manifests:
- name_template: 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}'
image_templates:
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-amd64'
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-arm64'
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-armv7'
- name_template: 'ghcr.io/caarlos0/{{ .ProjectName }}:latest'
image_templates:
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-amd64'
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-arm64'
- 'ghcr.io/caarlos0/{{ .ProjectName }}:{{ .Tag }}-armv7'
hey, yeah, its releasing for arm64 and amd64 only right now... feel free to open a pr here :)
you can remove the include from the docker config and copy over and change whats needed 🙏