Skip to content

Commit

Permalink
Merge pull request #8 from a-thomas-22/add-arm-build
Browse files Browse the repository at this point in the history
Add arm build
  • Loading branch information
thedatabaseme authored Oct 9, 2023
2 parents 36efa07 + 02089e4 commit 37c2ba9
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
7 changes: 7 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,12 @@ jobs:
type=ref,event=pr
type=semver,pattern={{version}}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to image repository
if: github.ref_type == 'tag'
uses: docker/login-action@v2
Expand All @@ -41,3 +47,4 @@ jobs:
push: ${{ github.ref_type == 'tag' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
25 changes: 19 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,29 +3,42 @@ FROM python:3.9.16-bullseye AS exporter-builder

WORKDIR /usr/src/

# Install exporter requirements and build
COPY requirements.txt /usr/src/
RUN pip3 install -r requirements.txt
ADD exporter.py /usr/src/
RUN pyinstaller --name exporter \
--onefile exporter.py && \
mv dist/exporter wal-g-prometheus-exporter

# Install wget and download wal-g
ARG TARGETARCH
RUN apt-get update && apt-get install -y wget && rm -rf /var/lib/apt/lists/* && \
if [ "${TARGETARCH}" = "arm64" ]; then \
export WALG_ARCH="aarch64"; \
else \
export WALG_ARCH="${TARGETARCH}"; \
fi && \
wget -O /wal-g-pg-ubuntu-20.04.tar.gz https://github.com/wal-g/wal-g/releases/download/v2.0.1/wal-g-pg-ubuntu-20.04-${WALG_ARCH}.tar.gz

# Build final image
FROM debian:11.6-slim

COPY --from=exporter-builder /usr/src/wal-g-prometheus-exporter /usr/bin/
ADD https://github.com/wal-g/wal-g/releases/download/v2.0.1/wal-g-pg-ubuntu-20.04-amd64.tar.gz /usr/bin/
COPY --from=exporter-builder /wal-g-pg-ubuntu-20.04.tar.gz /usr/bin/

RUN apt-get update && \
apt-get install -y ca-certificates daemontools && \
apt-get upgrade -y -q && \
apt-get dist-upgrade -y -q && \
apt-get -y -q autoclean && \
apt-get -y -q autoremove

RUN cd /usr/bin/ && \
tar -zxvf wal-g-pg-ubuntu-20.04-amd64.tar.gz && \
rm wal-g-pg-ubuntu-20.04-amd64.tar.gz && \
mv wal-g-pg-ubuntu-20.04-amd64 wal-g
tar -zxvf wal-g-pg-ubuntu-20.04.tar.gz && \
rm wal-g-pg-ubuntu-20.04.tar.gz && \
(mv wal-g-pg-ubuntu20.04-* wal-g || mv wal-g-pg-ubuntu-20.04-* wal-g)

COPY scripts/entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh

ENTRYPOINT ["/usr/bin/entrypoint.sh"]
ENTRYPOINT ["/usr/bin/entrypoint.sh"]

0 comments on commit 37c2ba9

Please sign in to comment.