Skip to content

Commit f5c96d6

Browse files
authored
Update Makefile and CI to all use Docker consistently (#147)
1 parent 6f902c6 commit f5c96d6

File tree

5 files changed

+46
-45
lines changed

5 files changed

+46
-45
lines changed

.buildkite/default-pipeline.yml

Lines changed: 0 additions & 8 deletions
This file was deleted.

.buildkite/docker-push.sh

Lines changed: 0 additions & 27 deletions
This file was deleted.

.buildkite/docker.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@
22
# $yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json
33
steps:
44
- label: "Build and publish Docker image"
5-
command: "./.buildkite/docker-push.sh"
5+
command: "make docker-push-elastic"
66
agents:
77
provider: "gcp"

.buildkite/pipeline.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,3 @@ steps:
2121
command: "/agent/check-catalog-info.sh"
2222
agents:
2323
image: "docker.elastic.co/ci-agent-images/pipelib:0.15.0@sha256:753c420cf254a7ed0be658ab153965e0708fe0636dfe2fe57e6e4ae0972bb681"
24-
- default:
25-
config:
26-
label: ":pipeline: Upload default Pipeline"
27-
command: "buildkite-agent pipeline upload .buildkite/default-pipeline.yml"

Makefile

Lines changed: 45 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,50 @@
1-
1+
# set version variable
2+
VERSION = $(shell grep '^version' Cargo.toml | head -n1 | cut -d ' ' -f3 | sed 's/"//g')
3+
ES_IMAGE = "docker.elastic.co/mcp/elasticsearch:$(VERSION)"
4+
ES_IMAGE_LATEST = "docker.elastic.co/mcp/elasticsearch:latest"
5+
AWS_IMAGE = "709825985650.dkr.ecr.us-east-1.amazonaws.com/elastic/mcp/elasticsearch:$(VERSION)"
26

37
help: ## Display help
48
@awk 'BEGIN {FS = ":.*##"; printf "Usage:\n make <target>\n"} /^[a-zA-Z_-]+:.*?##/ { printf " %-15s %s\n", $$1, $$2 } /^##@/ { printf "\n%s\n", substr($$0, 5) } ' $(MAKEFILE_LIST)
59

6-
docker-image: ## Build a docker image with the 'es-mcp' tag
7-
docker build -t es-mcp .
10+
.PHONY: docker-image
11+
docker-image: ## Build a local docker image named es-mcp
12+
docker build -t "es-mcp:$(VERSION)" .
13+
14+
.PHONY: docker-multiarch-image
15+
docker-multiarch-image: docker-buildx-builder ## Build an amd64+arm64 docker image
16+
docker buildx build \
17+
--platform linux/amd64,linux/arm64 \
18+
--builder es-mcp-multi-arch \
19+
--load \
20+
--tag "$(ES_IMAGE)" .
21+
docker tag "$(ES_IMAGE)" "$(ES_IMAGE_LATEST)"
22+
23+
.PHONY: docker-image-aws
24+
docker-image-aws: docker-buildx-builder ## Build an arm64 docker image using AWS-specific configuration
25+
docker buildx build \
26+
--platform linux/arm64 \
27+
--builder es-mcp-multi-arch \
28+
--load \
29+
--file Dockerfile-8000 \
30+
--tag "$(AWS_IMAGE)" .
31+
32+
.PHONY: docker-buildx-builder
33+
docker-buildx-builder: ## Set up multi-arch Docker buildx builder
34+
docker buildx ls | grep --silent es-mcp-multi-arch || \
35+
docker buildx create \
36+
--name es-mcp-multi-arch \
37+
--driver docker-container \
38+
--driver-opt default-load=true \
39+
--platform linux/amd64,linux/arm64 \
40+
--bootstrap
841

9-
docker-multiarch-image: ## Build an amd64+arm64 docker image with the 'es-mcp' tag
10-
docker buildx build --platform linux/amd64,linux/arm64 --tag es-mcp .
42+
.PHONY: docker-push-elastic
43+
docker-push-elastic: docker-multiarch-image ## Push multi-arch image to docker.elastic.co
44+
docker login \
45+
-u "devtoolsmachine" \
46+
-p "$(vault read -field=password secret/ci/elastic-mcp-server-elasticsearch/devtoolsmachine)" \
47+
docker.elastic.co
48+
docker push "$(ES_IMAGE)"
49+
docker push "$(ES_IMAGE_LATEST)"
50+
docker logout docker.elastic.co

0 commit comments

Comments
 (0)