Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

build cdc for multiarch #42

Merged
merged 1 commit into from
Aug 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
on:
pull_request:
push:
branches: [master]
jobs:
build:
strategy:
matrix:
arch: [amd64, arm64]
runs-on: ubuntu-latest
env:
IMG_CACHE: ghcr.io/getsentry/cdc:${{ matrix.arch }}-latest
IMG_VERSIONED: ghcr.io/getsentry/cdc:${{ matrix.arch }}-${{ github.sha }}
steps:
- uses: actions/checkout@v3
- run: docker run --rm --privileged tonistiigi/binfmt --install arm64
if: matrix.arch == 'arm64'
- name: build
run: |
set -euxo pipefail
args=()
if docker pull -q "$IMG_CACHE"; then
args+=(--cache-from "$IMG_CACHE")
fi
docker buildx build \
"${args[@]}" \
--build-arg BUILDKIT_INLINE_CACHE=1 \
--platform linux/${{ matrix.arch }} \
--tag "$IMG_VERSIONED" \
--target application \
.
docker tag "$IMG_VERSIONED" "$IMG_CACHE"
- name: push
run: |
set -euxo pipefail
docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io
docker push "$IMG_VERSIONED"
docker push "$IMG_CACHE"
if: github.event_name != 'pull_request'

multiarch:
if: github.event_name != 'pull_request'
needs: [build]
runs-on: ubuntu-latest
steps:
- run: |
set -euxo pipefail
docker login --username '${{ github.actor }}' --password '${{ secrets.GITHUB_TOKEN }}' ghcr.io
docker manifest create ghcr.io/getsentry/cdc:latest \
ghcr.io/getsentry/cdc:arm64-latest \
ghcr.io/getsentry/cdc:amd64-latest
docker manifest push ghcr.io/getsentry/cdc:latest
20 changes: 16 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ RUN set -x \
wget \
" \
&& apt-get update && apt-get install -y --no-install-recommends $fetchDeps && rm -rf /var/lib/apt/lists/* \
&& wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini" \
&& wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini.asc" \
&& wget -O /usr/local/bin/tini "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$(dpkg --print-architecture)" \
&& wget -O /usr/local/bin/tini.asc "https://github.com/krallin/tini/releases/download/v$TINI_VERSION/tini-$(dpkg --print-architecture).asc" \
&& export GNUPGHOME="$(mktemp -d)" \
&& for key in \
595E85A6B1B4779EA4DAAEC70B588DFF0527A9B7 \
Expand All @@ -58,7 +58,13 @@ RUN mkdir -p /usr/src/app
WORKDIR /usr/src/app

COPY requirements.txt /usr/src/app/
RUN pip install -r requirements.txt
RUN set -x \
&& deps='gcc librdkafka-dev libc-dev' \
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need this ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

confluent-kafka doesn't have a prebuilt on arm64 sadly

&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $deps \
&& pip install -r requirements.txt \
&& apt-get purge -y --auto-remove $deps \
&& rm -rf /var/lib/apt/lists/*

COPY . /usr/src/app
ENV PATH /usr/src/app/bin:$PATH
Expand All @@ -70,4 +76,10 @@ CMD ["cdc"]

FROM application AS development

RUN pip install -r requirements-dev.txt
RUN set -x \
&& deps='gcc' \
&& apt-get update \
&& DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends $deps \
&& pip install -r requirements-dev.txt \
&& apt-get purge -y --auto-remove $deps \
&& rm -rf /var/lib/apt/lists/*
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ PyYAML==5.1
confluent-kafka==0.11.6
datadog==0.21.0
jsonschema==3.0.1
psycopg2-binary==2.7.7
psycopg2-binary==2.9.3
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intentional?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah the older version does not build on arm64

sentry-sdk==0.7.14