Skip to content

Commit a4a05f5

Browse files
committed
Flatten from a job-local registry, not GHCR staging packages
Packages created by a public repo's workflow are born public, so the -staging packages were themselves redistributing the upstream enterprise layers. Push the unsquashed build to a registry:2 service on the runner instead and crane-flatten from there; the unflattened image never leaves the job.
1 parent 32151af commit a4a05f5

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

.github/workflows/build.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,21 @@ jobs:
3939
# -database image: consumed by the litellm helm chart (k0rdent)
4040
- upstream: litellm-database
4141
package: litellm-lagoon-base-database
42+
# The docker build pushes to this job-local registry first. Its result
43+
# still DISTRIBUTES the enterprise code: `rm -rf` in the Dockerfile only
44+
# masks files in the top layer, the inherited upstream layers keep the
45+
# content. The publish step crane-flattens it into a single layer at
46+
# $IMAGE, so only the post-rm filesystem ever leaves the runner. (A
47+
# GHCR staging package won't do: packages created from a public repo's
48+
# workflow are born public.)
49+
services:
50+
registry:
51+
image: registry:2
52+
ports:
53+
- 5000:5000
4254
env:
4355
IMAGE: ghcr.io/${{ github.repository_owner }}/${{ matrix.package }}
44-
# The docker build pushes here first. Its result still DISTRIBUTES the
45-
# enterprise code: `rm -rf` in the Dockerfile only masks files in the
46-
# top layer, the inherited upstream layers keep the content. The
47-
# publish step crane-flattens staging into a single layer at $IMAGE,
48-
# so only the post-rm filesystem is ever public. The -staging packages
49-
# must therefore STAY PRIVATE.
50-
STAGING: ghcr.io/${{ github.repository_owner }}/${{ matrix.package }}-staging
56+
STAGING: localhost:5000/${{ matrix.package }}
5157
steps:
5258
- uses: actions/checkout@v4
5359

@@ -93,6 +99,9 @@ jobs:
9399

94100
- uses: docker/setup-buildx-action@v3
95101
if: steps.published.outputs.exists != 'true'
102+
with:
103+
# Let the buildkit container reach the job-local registry service.
104+
driver-opts: network=host
96105

97106
- uses: docker/build-push-action@v6
98107
if: steps.published.outputs.exists != 'true'

0 commit comments

Comments
 (0)