Skip to content

Commit 7eaa3c1

Browse files
aldy505oiokiclaude
authored
feat: publish Docker image to GHCR (#218)
* ref: publish Docker image to GHCR * ci: craft default release branch name is 'release' * ref: use ghcr image for devservices * chore: Use bullseye image variant * chore: add libpangocairo * ci: test on forks, I don't have arm64 runner laying around * chore: bump canvas to next major version Release notes says this is a migration to N-API, no code changes - https://github.com/Automattic/node-canvas/releases/tag/v3.0.0 * ci: remove debugging commands * ci: conflicting job name * ci: don't publish on PR for external contributors * switch base images to GHCR * ci: Run build workflow on pull requests Fork PRs don't trigger push events in the main repo, so the build check was never running for external contributors. Adding pull_request trigger uses a read-only token with no secret access, which is safe. Co-Authored-By: Claude <noreply@anthropic.com> --------- Co-authored-by: Alexander Tarasov <alex.tarasov@sentry.io> Co-authored-by: Claude <noreply@anthropic.com>
1 parent 04c0471 commit 7eaa3c1

6 files changed

Lines changed: 95 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: build
2-
on: [push]
2+
on: [push, pull_request]
33

44
jobs:
55
build:

.github/workflows/image.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Docker Image
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
- release/**
9+
jobs:
10+
build-docker-image:
11+
runs-on: ${{ matrix.os }}
12+
strategy:
13+
matrix:
14+
include:
15+
- os: ubuntu-24.04
16+
platform: amd64
17+
- os: ubuntu-24.04-arm
18+
platform: arm64
19+
name: build-docker-image-${{ matrix.platform }}
20+
permissions:
21+
contents: read
22+
packages: write
23+
steps:
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
26+
- name: Build and push chartcuterie image
27+
uses: getsentry/action-build-and-push-images@b172ab61a5f7eabd58bd42ce231b517e79947c01
28+
with:
29+
image_name: 'chartcuterie'
30+
platforms: linux/${{ matrix.platform }}
31+
dockerfile_path: './Dockerfile'
32+
ghcr: ${{ github.event_name != 'pull_request' }}
33+
tag_suffix: -${{ matrix.platform }}
34+
publish_on_pr: ${{ github.event.pull_request.author_association == 'OWNER' || github.event.pull_request.author_association == 'MEMBER' }}
35+
google_ar: false
36+
tag_nightly: false
37+
tag_latest: false
38+
39+
assemble-chartcuterie-image:
40+
runs-on: ubuntu-latest
41+
needs: [build-docker-image]
42+
if: ${{ (github.ref_name == 'master' || startsWith(github.ref_name, 'release/')) && github.event_name != 'pull_request' }}
43+
permissions:
44+
contents: read
45+
packages: write
46+
steps:
47+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48+
49+
- run: docker login --username '${{ github.actor }}' --password-stdin ghcr.io <<< "$GHCR_TOKEN"
50+
env:
51+
GHCR_TOKEN: ${{ secrets.GITHUB_TOKEN }}
52+
53+
- name: Set up Docker Buildx
54+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
55+
56+
- name: Create multiplatform manifests
57+
run: |
58+
docker buildx imagetools create \
59+
--tag ghcr.io/getsentry/chartcuterie:${{ github.event.pull_request.head.sha || github.sha }} \
60+
--tag ghcr.io/getsentry/chartcuterie:nightly \
61+
ghcr.io/getsentry/chartcuterie:${{ github.event.pull_request.head.sha || github.sha }}-amd64 \
62+
ghcr.io/getsentry/chartcuterie:${{ github.event.pull_request.head.sha || github.sha }}-arm64
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Release GHCR Versioned Image
2+
3+
on:
4+
release:
5+
types: [prereleased, released]
6+
7+
jobs:
8+
release-ghcr-version-tag:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Log in to GitHub Container Registry
12+
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
13+
with:
14+
registry: ghcr.io
15+
username: ${{ github.actor }}
16+
password: ${{ secrets.GITHUB_TOKEN }}
17+
18+
- name: Tag release version
19+
run: |
20+
docker buildx imagetools create --tag \
21+
ghcr.io/getsentry/chartcuterie:${{ github.ref_name }} \
22+
ghcr.io/getsentry/chartcuterie:${{ github.sha }}
23+
24+
- name: Tag latest version
25+
run: |
26+
docker buildx imagetools create --tag \
27+
ghcr.io/getsentry/chartcuterie:latest \
28+
ghcr.io/getsentry/chartcuterie:${{ github.sha }}

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM us-docker.pkg.dev/sentryio/dhi/node:24-debian13-dev AS builder
1+
FROM ghcr.io/getsentry/dhi/node:24-debian13-dev AS builder
22

33
WORKDIR /build
44

@@ -37,7 +37,7 @@ RUN apt-get update -qq && \
3737
rm -rf /var/lib/apt/lists/*
3838

3939

40-
FROM us-docker.pkg.dev/sentryio/dhi/node:24-debian13
40+
FROM ghcr.io/getsentry/dhi/node:24-debian13
4141

4242
ENV NODE_ENV=production
4343

devservices/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ x-sentry-service-config:
1010

1111
services:
1212
chartcuterie:
13-
image: us-central1-docker.pkg.dev/sentryio/chartcuterie/image:latest
13+
image: ghcr.io/getsentry/chartcuterie:nightly
1414
environment:
1515
CHARTCUTERIE_CONFIG: /etc/chartcuterie/config.js
1616
CHARTCUTERIE_CONFIG_POLLING: true

yarn.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5605,7 +5605,7 @@ safe-array-concat@^1.1.3:
56055605

56065606
safe-buffer@^5.0.1, safe-buffer@~5.2.0:
56075607
version "5.2.1"
5608-
resolved "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz"
5608+
resolved "https://registry.yarnpkg.com/safe-buffer/-/safe-buffer-5.2.1.tgz#1eaf9fa9bdb1fdd4ec75f58f9cdb4e6b7827eec6"
56095609
integrity sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==
56105610

56115611
safe-push-apply@^1.0.0:

0 commit comments

Comments
 (0)