Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ jobs:
uses: actions/checkout@v4

- name: Build Container
run: make container VERSION=test
run: make container VERSION=test
88 changes: 59 additions & 29 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,50 +12,80 @@ permissions:

jobs:

deploy:
build-platform-image:

name: Build and Push Container
runs-on: ubuntu-latest
name: Build (${{ matrix.platform }})
permissions:
contents: write
id-token: write
environment:
name: release
strategy:
matrix:
platform:
- amd64
- arm64
include:
- platform: amd64
runner: ubuntu-24.04
- platform: arm64
runner: ubuntu-24.04-arm

runs-on: ${{ matrix.runner }}

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ vars.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_SECRET }}
- name: "Free up some disk space"
run: |
sudo rm -rf /usr/share/dotnet /usr/local/lib/android /opt/ghc
sudo rm -rf /opt/hostedtoolcache/CodeQL
podman image prune --all --force
podman builder prune -a -f

- name: Docker Hub token
run: echo ${{ secrets.DOCKER_SECRET }} > docker-token.txt

- name: Authenticate with Docker hub
run: make docker-hub-login

- name: Get version
id: version
run: echo VERSION=$(git describe --exact-match --tags | sed 's/^v//') >> $GITHUB_OUTPUT

- name: Extract metadata for container
id: meta
uses: docker/metadata-action@v5
with:
images: trustgraph/ddg-mcp-server
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha

- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./Containerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
- name: Build container
run: make platform-${{ matrix.platform }} VERSION=${{ steps.version.outputs.VERSION }}

- name: Push container
run: make push-platform-${{ matrix.platform }} VERSION=${{ steps.version.outputs.VERSION }}

combine-manifest:

name: Combine manifest
runs-on: ubuntu-24.04
needs: build-platform-image
permissions:
contents: write
id-token: write
environment:
name: release

steps:

- name: Checkout
uses: actions/checkout@v4

- name: Docker Hub token
run: echo ${{ secrets.DOCKER_SECRET }} > docker-token.txt

- name: Authenticate with Docker hub
run: make docker-hub-login

- name: Get version
id: version
run: echo VERSION=$(git describe --exact-match --tags | sed 's/^v//') >> $GITHUB_OUTPUT

- name: Combine and push manifest
run: make combine-manifest VERSION=${{ steps.version.outputs.VERSION }}
55 changes: 52 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,63 @@

VERSION=0.1.0
CONTAINER_BASE=docker.io/trustgraph
CONTAINER=ddg-mcp-server
DOCKER=podman

all: container

container:
${DOCKER} build -f Containerfile -t ${CONTAINER}:${VERSION} \
--format docker
${DOCKER} build -f Containerfile -t ${CONTAINER_BASE}/${CONTAINER}:${VERSION} \
--format docker .

push:
${DOCKER} push ${CONTAINER}:${VERSION}
${DOCKER} push ${CONTAINER_BASE}/${CONTAINER}:${VERSION}

# Multi-arch: build both platforms sequentially into one manifest (local use)
manifest:
-@${DOCKER} manifest rm \
${CONTAINER_BASE}/${CONTAINER}:${VERSION}
${DOCKER} build --platform linux/amd64,linux/arm64 \
-f Containerfile \
--manifest \
${CONTAINER_BASE}/${CONTAINER}:${VERSION} .

# Multi-arch: build a single platform image (for parallel CI)
platform-amd64:
${DOCKER} build --platform linux/amd64 \
-f Containerfile \
-t ${CONTAINER_BASE}/${CONTAINER}:${VERSION}-amd64 .

platform-arm64:
${DOCKER} build --platform linux/arm64 \
-f Containerfile \
-t ${CONTAINER_BASE}/${CONTAINER}:${VERSION}-arm64 .

# Push a single platform image
push-platform-amd64:
${DOCKER} push \
${CONTAINER_BASE}/${CONTAINER}:${VERSION}-amd64

push-platform-arm64:
${DOCKER} push \
${CONTAINER_BASE}/${CONTAINER}:${VERSION}-arm64

# Combine per-platform images into a multi-arch manifest
combine-manifest:
-@${DOCKER} manifest rm \
${CONTAINER_BASE}/${CONTAINER}:${VERSION}
${DOCKER} manifest create \
${CONTAINER_BASE}/${CONTAINER}:${VERSION} \
docker://${CONTAINER_BASE}/${CONTAINER}:${VERSION}-amd64 \
docker://${CONTAINER_BASE}/${CONTAINER}:${VERSION}-arm64
${DOCKER} manifest push \
${CONTAINER_BASE}/${CONTAINER}:${VERSION}

# Push a manifest (from local multi-arch build)
push-manifest:
${DOCKER} manifest push \
${CONTAINER_BASE}/${CONTAINER}:${VERSION}

docker-hub-login:
cat docker-token.txt | \
${DOCKER} login -u trustgraph --password-stdin registry-1.docker.io
Loading