Skip to content

Commit

Permalink
Build the Docker image for Intel and ARM
Browse files Browse the repository at this point in the history
  • Loading branch information
rcrowley committed Jul 16, 2024
1 parent f6a8b45 commit f9930fd
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Build mysqld_exporter
run: make build

- name: Log in to the Container registry
uses: docker/login-action@v3
with:
Expand All @@ -45,6 +42,7 @@ jobs:
with:
context: .
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.meta.outputs.tags }}

Expand Down
21 changes: 12 additions & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
ARG ARCH="amd64"
ARG OS="linux"
FROM quay.io/prometheus/busybox-${OS}-${ARCH}:latest
LABEL maintainer="The Prometheus Authors <[email protected]>"
FROM --platform=$BUILDPLATFORM golang:bookworm AS build
ARG TARGETOS
ARG TARGETARCH
RUN apt-get -y install make
COPY . /mysqld_exporter
RUN rm -f /mysqld_exporter/mysqld_exporter
RUN CGO_ENABLED=0 GOOS="$TARGETOS" GOARCH="$TARGETARCH" make -C /mysqld_exporter build

COPY ./mysqld_exporter /bin/mysqld_exporter

EXPOSE 9104
USER nobody
ENTRYPOINT [ "/bin/mysqld_exporter" ]
FROM golang:alpine
COPY --from=build /mysqld_exporter/mysqld_exporter /bin/mysqld_exporter
EXPOSE 9104
USER nobody
ENTRYPOINT ["/bin/mysqld_exporter"]

0 comments on commit f9930fd

Please sign in to comment.