Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docker: Re-enable multi-arch build: arm, arm64, amd64 #105

Open
joekhoobyar opened this issue Dec 23, 2022 · 22 comments
Open

Docker: Re-enable multi-arch build: arm, arm64, amd64 #105

joekhoobyar opened this issue Dec 23, 2022 · 22 comments
Labels
bug Something isn't working

Comments

@joekhoobyar
Copy link

The last multi-arch build was v0.7.0.

Is there any reason not to re-enable it?

@martivo
Copy link

martivo commented Feb 3, 2023

This seems to be when it got dropped #79
To work around it:

FROM alpine:3
LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"
RUN apk add smartmontools

RUN wget https://github.com/prometheus-community/smartctl_exporter/releases/download/v0.9.1/smartctl_exporter-0.9.1.linux-arm64.tar.gz && tar xvzf smartctl_exporter-0.9.1.linux-arm64.tar.gz && ls -l smartctl_exporter-0.9.1.linux-arm64.tar.gz && mv smartctl_exporter-0.9.1.linux-arm64/smartctl_exporter /bin/smartctl_exporter && rm -rf smartctl_exporter-0.9.1.linux-*

EXPOSE      9633
USER        nobody
ENTRYPOINT  [ "/bin/smartctl_exporter" ]

@frittentheke
Copy link

@joekhoobyar I suppose this issue is fixed ... recent builds are for all sorts of archs: https://github.com/prometheus-community/smartctl_exporter/releases/tag/v0.10.0

@NiceGuyIT
Copy link
Member

Yup. arm64 was built in the latest release.

@jfcoz
Copy link
Contributor

jfcoz commented Aug 16, 2023

Hi
arm64 is build in release, but the arm64 docker image is still missing on https://quay.io/repository/prometheuscommunity/smartctl-exporter?tab=tags

@NiceGuyIT
Copy link
Member

Thanks for catching that @jfcoz. The title and OP doesn't mention Docker. Let's fix that.

@NiceGuyIT NiceGuyIT reopened this Aug 17, 2023
@NiceGuyIT NiceGuyIT changed the title Re-enable multi-arch build: arm, arm64, amd64 Docker: Re-enable multi-arch build: arm, arm64, amd64 Aug 17, 2023
@NiceGuyIT NiceGuyIT added the bug Something isn't working label Aug 17, 2023
@NiceGuyIT
Copy link
Member

@SuperQ Can you elaborate on this issue? I couldn't find a related issue in the Prometheus common repo.

From PR #78 (link):

The problem is alpine doesn't tag their multi-arch images the same way Prometheus busybox does.

@SuperQ
Copy link
Contributor

SuperQ commented Aug 17, 2023

Our standard base container, the busybox container, has a naming convention so we can select which arch output.

For example:

ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest

We use alpine here for the base container so we can get smartmontools installed. I couldn't figure out a way to parameterize the ARCH in the alpine FROM.

In theory, it should work with FROM arm64v8/alpine:3, but I think we would need to run on an ARM worker node for the apk add to function.

@NiceGuyIT
Copy link
Member

Adding the response here to keep the thread.

@jfcoz PR #150 didn't work. The prometheuscommunity/smartctl-exporter image shows 2 hashes for linux/amd64.
image

Meanwhile, prometheuscommunity/smartctl-exporter-linux-arm64 has a linux/amd64 os/arch.
image

I'm going to revert the changes.

@stepanbaghdasaryan
Copy link

Unfortunately there is still no arm64 image in the latest or in v0.11.0 version.

https://quay.io/repository/prometheuscommunity/smartctl-exporter/manifest/sha256:aa34799fcc8d278e427a3995bbdc334e7be6508cb8b2d406f38a3a1a2b1b582f

Is it known when this will be fixed?

@joryirving
Copy link

Also interested in an ARM image.

@joryirving
Copy link

@stepanbaghdasaryan
Copy link

@NiceGuyIT Are there some known issues or blockers why you still don't activate the support for ARM64 Docker images??

@dimm0
Copy link

dimm0 commented Apr 19, 2024

Also interested in re-enabling this

@NiceGuyIT
Copy link
Member

@stepanbaghdasaryan This issue is to provide a multi-architecture build in prometheuscommunity/smartctl-exporter. PR #150 did not fix the mutli-arch build and thus was reverted.

However, in hind sight, I see it enabled prometheuscommunity/smartctl-exporter-linux-arm64 which is a different image. I.e. it's not multi-arch. Enabling this build until the mutli-arch is fixed is better than having no build. I'll see about enabling PR #150 or creating another PR.

As for why multi-architecture is not working, see SuperQ's comment.

@dimm0
Copy link

dimm0 commented Apr 23, 2024

I'm using gitlab ci/cd, never used GitHub Actions, but it should be pretty straightforward as well with buildx?

https://blog.thesparktree.com/docker-multi-arch-github-actions

@martivo
Copy link

martivo commented Apr 24, 2024

If it is any help this is how we build multi arch images using buildx on github actions:

      - name: Set up QEMU
        uses: docker/setup-qemu-action@v3
      - name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v3
      - name: Build and push image
        env:
          DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
          DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
        run: |
          echo $DOCKER_PASSWORD | docker login -u $DOCKER_USERNAME --password-stdin
          docker buildx build --push --platform linux/arm64/v8,linux/amd64 -t image:latest .

@kashalls
Copy link

kashalls commented May 8, 2024

This can be done with the official docker/build-push-action and docker/setup-buildx-action available with github actions. I can implement this if someone tells me where it should belong or you can look at how I set this up to build a nodejs package into a container with multi-arch: github.com/kashalls/border

@brettinternet
Copy link

Is there a workaround with this when using the helm chart prometheus-smartctl-exporter?

@nairol203
Copy link

I would really appreciate an arm version for the docker image

@NiceGuyIT
Copy link
Member

@SuperQ Can you give me access to the prometheuscommunity organization on CircleCI so I can troubleshoot the build process? Any insight into the build process is also appreciated.

@kashalls
Copy link

@NiceGuyIT At one point, I was just going to PR it so that it builds to GHCR packages. If you want I can still do that.

@alex-dna-tech
Copy link

alex-dna-tech commented Nov 2, 2024

My temporary solution is to build a custom container from the released tarball:

docker-compose.yml

services:
  smartctl-exporter:
    build:
      context: ./
      dockerfile: Dockerfile
      args:
        ARCH: "arm64"
        VERSION: "0.12.0"
    restart: unless-stopped
    privileged: true

Dockerfile

FROM alpine AS downloader
ARG ARCH="amd64"
ARG VERSION="0.12.0"

RUN wget -O release.tar.gz https://github.com/prometheus-community/smartctl_exporter/releases
/download/v${VERSION}/smartctl_exporter-${VERSION}.linux-${ARCH}.tar.gz \
    && tar -xzf release.tar.gz__docker-compose.yml__

FROM alpine:latest
ARG ARCH="amd64"
ARG VERSION="0.12.0"

LABEL maintainer="The Prometheus Authors <prometheus-developers@googlegroups.com>"

RUN apk --no-cache add smartmontools
COPY --from=downloader /smartctl_exporter-${VERSION}.linux-${ARCH}/smartctl_exporter /bin/sma
rtctl_exporter

EXPOSE      9633
USER        nobody
ENTRYPOINT  [ "/bin/smartctl_exporter" ]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests