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

Commit

Permalink
build cdc for multiarch
Browse files Browse the repository at this point in the history
  • Loading branch information
asottile-sentry committed Aug 26, 2022
1 parent 8643ee7 commit caf3b5c
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 5 deletions.
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' \
&& 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
sentry-sdk==0.7.14

0 comments on commit caf3b5c

Please sign in to comment.