Skip to content

Commit 140c67d

Browse files
committed
fix: Revert to simpler multi-arch build approach
- Remove complex separate architecture builds that caused tag issues - Back to single multi-arch build with linux/amd64,linux/arm64 - Simplified attestation approach with provenance=true, sbom=true - Remove architecture-specific testing that failed on runners - This should resolve the tag naming and architecture mismatch issues
1 parent 98c17e6 commit 140c67d

File tree

1 file changed

+15
-79
lines changed

1 file changed

+15
-79
lines changed

.github/workflows/docker-build.yml

Lines changed: 15 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,6 @@ jobs:
4545
build:
4646
runs-on: ubuntu-latest
4747
needs: test # Only build if tests pass
48-
strategy:
49-
matrix:
50-
variant:
51-
- name: amd64
52-
dockerfile: Dockerfile
53-
platforms: linux/amd64
54-
- name: arm64
55-
dockerfile: Dockerfile
56-
platforms: linux/arm64
5748

5849
steps:
5950
- name: Checkout repository
@@ -81,30 +72,28 @@ jobs:
8172
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
8273
flavor: |
8374
latest=auto
84-
suffix=-${{ matrix.variant.name }}
8575
tags: |
86-
# Create architecture-specific tags first
87-
type=raw,value=latest-${{ matrix.variant.name }},enable={{is_default_branch}}
76+
# Always create latest tag for master branch pushes with attestations
77+
type=raw,value=latest,enable={{is_default_branch}}
8878
# Create version tags (v1.0.0) when pushing git tags
89-
type=semver,pattern={{version}}-${{ matrix.variant.name }}
79+
type=semver,pattern={{version}}
9080
# Create SHA tags for attestation linking
91-
type=sha,prefix={{branch}}-{{date 'YYYYMMDD-HHmmss'}}-${{ matrix.variant.name }}-
81+
type=sha,prefix={{branch}}-{{date 'YYYYMMDD-HHmmss'}}-
9282
93-
# Build locally first for security scanning (both architectures)
83+
# Build locally first for security scanning (AMD64 only)
9484
- name: Build Docker image for scanning
9585
uses: docker/build-push-action@v6
9686
with:
9787
context: .
98-
file: ${{ matrix.variant.dockerfile }}
99-
platforms: ${{ matrix.variant.platforms }}
88+
file: Dockerfile
89+
platforms: linux/amd64
10090
push: false
10191
load: true
102-
tags: local-scan:${{ matrix.variant.name }}
92+
tags: local-scan:latest
10393
cache-from: type=gha
10494

105-
# Security scanning with Docker Scout CLI (both architectures)
95+
# Security scanning with Docker Scout CLI
10696
- name: Docker Scout security scan
107-
continue-on-error: ${{ matrix.variant.name == 'arm64' }} # ARM64 scanning can be flaky
10897
timeout-minutes: 10 # Prevent hanging
10998
run: |
11099
# Install Docker Scout CLI
@@ -144,15 +133,15 @@ jobs:
144133
uses: docker/build-push-action@v6
145134
with:
146135
context: .
147-
file: ${{ matrix.variant.dockerfile }}
148-
platforms: ${{ matrix.variant.platforms }}
136+
file: Dockerfile
137+
platforms: linux/amd64,linux/arm64
149138
push: ${{ github.event_name != 'pull_request' }}
150139
tags: ${{ steps.meta.outputs.tags }}
151140
labels: ${{ steps.meta.outputs.labels }}
152141
cache-from: type=gha
153142
cache-to: type=gha,mode=max
154143
# Enable attestations for supply chain security
155-
provenance: mode=max
144+
provenance: true
156145
sbom: true
157146

158147
- name: Test Docker image functionality
@@ -165,7 +154,7 @@ jobs:
165154
# Test that the image starts and shows help (basic functionality)
166155
echo "Testing server help output..."
167156
if docker run --rm $FIRST_TAG --help | grep -q "SQLite MCP Server"; then
168-
echo "✅ ${{ matrix.variant.name }} image: Server starts and shows help correctly"
157+
echo "✅ Image: Server starts and shows help correctly"
169158
else
170159
echo "❌ Server help test failed"
171160
exit 1
@@ -174,13 +163,13 @@ jobs:
174163
# Test that the Python environment is working by overriding entrypoint
175164
echo "Testing Python environment..."
176165
if docker run --rm --entrypoint python $FIRST_TAG -c "import sys; print('✅ Python environment working')"; then
177-
echo "✅ ${{ matrix.variant.name }} image: Python environment functional"
166+
echo "✅ Image: Python environment functional"
178167
else
179168
echo "❌ Python environment test failed"
180169
exit 1
181170
fi
182171
183-
echo "✅ ${{ matrix.variant.name }} image tests passed"
172+
echo "✅ Image tests passed"
184173
185174
# Generate GitHub attestations for supply chain security
186175
- name: Generate artifact attestation
@@ -191,56 +180,3 @@ jobs:
191180
subject-digest: ${{ steps.build.outputs.digest }}
192181
push-to-registry: true
193182
continue-on-error: true # Don't fail build if attestation fails
194-
195-
# Create multi-arch manifest after both architectures are built
196-
manifest:
197-
runs-on: ubuntu-latest
198-
needs: build
199-
if: github.event_name != 'pull_request'
200-
201-
steps:
202-
- name: Set up Docker Buildx
203-
uses: docker/setup-buildx-action@v3
204-
205-
- name: Log in to Docker Hub
206-
uses: docker/login-action@v3
207-
with:
208-
registry: ${{ env.REGISTRY }}
209-
username: ${{ secrets.DOCKER_USERNAME }}
210-
password: ${{ secrets.DOCKER_PASSWORD }}
211-
212-
- name: Create and push multi-arch manifest
213-
run: |
214-
# Get the current date and commit for consistent tagging
215-
DATE=$(date '+%Y%m%d-%H%M%S')
216-
SHORT_SHA=$(echo ${{ github.sha }} | cut -c1-7)
217-
218-
# Create multi-arch manifest for latest tag
219-
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
220-
echo "Creating multi-arch manifest for latest tag..."
221-
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest \
222-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-amd64 \
223-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest-arm64
224-
225-
# Create multi-arch manifest for SHA tag
226-
echo "Creating multi-arch manifest for SHA tag..."
227-
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:master-${DATE}-${SHORT_SHA} \
228-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:master-${DATE}-amd64-${SHORT_SHA} \
229-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:master-${DATE}-arm64-${SHORT_SHA}
230-
fi
231-
232-
# Create multi-arch manifest for version tags (if this is a tag push)
233-
if [[ "${{ github.ref }}" == refs/tags/* ]]; then
234-
VERSION=${GITHUB_REF#refs/tags/}
235-
echo "Creating multi-arch manifest for version tag: $VERSION"
236-
docker buildx imagetools create -t ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION} \
237-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-amd64 \
238-
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${VERSION}-arm64
239-
fi
240-
241-
- name: Verify multi-arch manifest
242-
run: |
243-
if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then
244-
echo "Verifying latest manifest..."
245-
docker buildx imagetools inspect ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
246-
fi

0 commit comments

Comments
 (0)