Skip to content

Commit 493847a

Browse files
Slim/cleanup (#135)
* try to use backend sock to pull images with logged in user * Remove backend service that wasn't being used.
1 parent a78ffd9 commit 493847a

File tree

9 files changed

+80
-44
lines changed

9 files changed

+80
-44
lines changed

.github/workflows/prompts-docker.yml

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,23 @@ jobs:
1515
with:
1616
submodules: false
1717

18-
- name: Set up QEMU
19-
uses: docker/setup-qemu-action@v3
18+
- name: Login to Docker Hub
19+
uses: docker/login-action@v3
20+
with:
21+
username: ${{ secrets.JIM_USERNAME }}
22+
password: ${{ secrets.JIM_PAT }}
2023

2124
- name: Set up Docker Buildx
2225
uses: docker/setup-buildx-action@v3
23-
24-
- name: Login to Docker Hub
25-
uses: docker/login-action@v3
2626
with:
27-
username: ${{ secrets.TEMP_DOCKER_USERNAME }}
28-
password: ${{ secrets.TEMP_DOCKER_PAT }}
27+
driver: cloud
28+
endpoint: "mcp/cloud-ai-labs"
29+
install: true
2930

3031
- name: Build and push
3132
uses: docker/build-push-action@v5
3233
with:
3334
context: .
3435
platforms: linux/amd64,linux/arm64
3536
push: true
36-
tags: vonwig/prompts:latest,mcp/run:latest,mcp/docker:latest
37+
tags: mcp/docker:latest

prompts/mcp/neo4j-server.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
2+
---
3+
mcp:
4+
- container:
5+
image: mcp/neo4j-server:latest
6+
workdir: /app
7+
secrets:
8+
neo4j.password: NEO4J_PASSWORD
9+
neo4j.username: NEO4J_USERNAME
10+
entrypoint:
11+
- "/app/mcp-neo4j-memory"
12+
command:
13+
- --db-url
14+
- "{{neo4j.url}}"
15+
- --username
16+
- "${NEO4J_USERNAME}"
17+
- --password
18+
- "${NEO4J_PASSWORD}"
19+
source:
20+
url: https://github.com/slimslenderslacks/mcp-neo4j
21+
---

runbook.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ docker pull mcp/docker:prerelease
2020

2121
```sh
2222
# docker:command=build-release
23-
VERSION="0.0.11"
23+
VERSION="0.0.12"
2424
docker buildx build \
2525
--builder hydrobuild \
2626
--platform linux/amd64,linux/arm64 \

src/docker.clj

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@
5858
:throw false}
5959
(when (or creds identity-token)
6060
{:headers {"X-Registry-Auth"
61-
;; I don't think we'll be pulling images
62-
;; from registries that support identity tokens
61+
;; I don't think we'll be pulling images
62+
;; from registries that support identity tokens
6363
(-> (cond
6464
identity-token {:identitytoken identity-token}
6565
creds creds)
@@ -71,7 +71,7 @@
7171
s))
7272

7373
(defn- get-backend-socket []
74-
(let [coll [(or (System/getenv "DOCKER_DESKTOP_SOCKET_PATH") "")
74+
(let [coll [(or (System/getenv "DOCKER_DESKTOP_SOCKET_PATH") "/backend.sock")
7575
(format "%s/Library/Containers/com.docker.docker/Data/backend.sock" (System/getenv "HOME"))]]
7676
(some unix-socket-file coll)))
7777

@@ -309,6 +309,16 @@
309309
{:creds {:username (:user m)
310310
:password (or (:jwt m) (:pat m))}}))))
311311

312+
(defn -add-token [m]
313+
(merge
314+
m
315+
(try
316+
(when (is-logged-in? m)
317+
{:jwt (get-token m)
318+
:user (:id (get-login-info m))})
319+
(catch Throwable t
320+
(logger/warn "user is not logged in to Docker Destkop")))))
321+
312322
(defn has-image? [image]
313323
(let [[_ digest] (re-find #".*@(.*)" image)]
314324
(some
@@ -321,7 +331,7 @@
321331
(defn check-then-pull [container-definition]
322332
(when (not (has-image? (:image container-definition)))
323333
(logger/info "pulling image " (:image container-definition))
324-
(-pull container-definition)))
334+
((comp -pull -add-token) container-definition)))
325335

326336
(defn injected-entrypoint [secrets environment s]
327337
(->> (concat
@@ -595,8 +605,7 @@
595605
"creates and starts container, then writes to stdin process
596606
returns container map with Id, and socket - socket is open socket to stdin"
597607
[m]
598-
(when (not (has-image? (:image m)))
599-
(-pull m))
608+
(check-then-pull m)
600609
(let [x (merge
601610
m
602611
(create (assoc m

src/extension/Dockerfile

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
# syntax=docker/dockerfile:1.4
2-
FROM golang:1.24-alpine AS builder
3-
ENV CGO_ENABLED=0
4-
WORKDIR /backend
5-
COPY backend/go.* .
6-
RUN --mount=type=cache,target=/go/pkg/mod \
7-
--mount=type=cache,target=/root/.cache/go-build \
8-
go mod download
9-
COPY backend/. .
10-
RUN --mount=type=cache,target=/go/pkg/mod \
11-
--mount=type=cache,target=/root/.cache/go-build \
12-
go build -trimpath -ldflags="-s -w" -o bin/service
1+
## syntax=docker/dockerfile:1.4
2+
#FROM golang:1.24-alpine AS builder
3+
#ENV CGO_ENABLED=0
4+
#WORKDIR /backend
5+
#COPY backend/go.* .
6+
#RUN --mount=type=cache,target=/go/pkg/mod \
7+
#--mount=type=cache,target=/root/.cache/go-build \
8+
#go mod download
9+
#COPY backend/. .
10+
#RUN --mount=type=cache,target=/go/pkg/mod \
11+
#--mount=type=cache,target=/root/.cache/go-build \
12+
#go build -trimpath -ldflags="-s -w" -o bin/service
1313

1414
FROM --platform=$BUILDPLATFORM node:23-alpine3.20 AS client-builder
1515
WORKDIR /ui
@@ -34,14 +34,14 @@ LABEL org.opencontainers.image.title="AI Tool Catalog" \
3434
com.docker.extension.categories="utility-tools" \
3535
com.docker.extension.changelog="Added MCP catalog"
3636

37-
COPY --from=builder /backend/bin/service /
37+
#COPY --from=builder /backend/bin/service /
3838
COPY docker-compose.yaml .
3939
COPY metadata.json .
4040
COPY docker.svg /docker.svg
4141
COPY host-binary/dist/windows-${TARGETARCH}/host-binary.exe /windows/host-binary.exe
4242
COPY host-binary/dist/darwin-${TARGETARCH}/host-binary /darwin/host-binary
4343
COPY host-binary/dist/linux-${TARGETARCH}/host-binary /linux/host-binary
4444
COPY --from=client-builder /ui/build ui
45-
COPY data /data
45+
#COPY data /data
4646

47-
CMD ["/service", "-socket", "/run/guest-services/backend.sock"]
47+
#CMD ["/service", "-socket", "/run/guest-services/backend.sock"]

src/extension/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# IMAGE?=docker/labs-ai-tools-for-devs
22
IMAGE?=docker/labs-ai-tools-for-devs
3-
TAG?=0.2.39
3+
TAG?=0.2.41
44

55
BUILDER=buildx-multi-arch
66

src/extension/docker-compose.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
services:
2-
dait:
3-
image: ${DESKTOP_PLUGIN_IMAGE}
4-
volumes:
5-
- "data:/data"
62
mcp_docker:
7-
image: mcp/docker:0.0.11
3+
image: mcp/docker:0.0.12
84
ports:
95
- 8811:8811
106
volumes:
117
- "/var/run/docker.sock:/var/run/docker.sock"
8+
- "/run/host-services/backend.sock:/backend.sock"
129
- "docker-prompts:/prompts"
1310
command:
1411
- serve
@@ -18,5 +15,3 @@ services:
1815
volumes:
1916
docker-prompts:
2017
name: docker-prompts
21-
data:
22-
name: data

src/extension/metadata.json

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
{
22
"icon": "docker.svg",
33
"vm": {
4-
"composefile": "docker-compose.yaml",
5-
"exposes": {
6-
"socket": "backend.sock"
7-
}
4+
"composefile": "docker-compose.yaml"
85
},
96
"ui": {
107
"dashboard-tab": {

test/docker_t.clj

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
(ns docker-t
2-
(:require [clojure.test :as t]
3-
[docker]))
2+
(:require
3+
[clojure.test :as t]
4+
[docker]
5+
[jsonrpc.logger :as logger]
6+
repl))
47

58
(t/deftest port-parsing-tests
69

@@ -48,3 +51,13 @@
4851
{:secrets {:notion.integration_secret "INTEGRATION_SECRET"}
4952
:environment {"OPENAPI_MCP_HEADERS" "\"{\\\"Authorization\": \\\"Bearer $INTEGRATION_SECERET\\\", \\\"Notion-Version\\\": \\\"2022-06-28\\\"}\""}
5053
:image "mcp/notion:latest"})))))
54+
55+
(comment
56+
(repl/setup-stdout-logger)
57+
(docker/has-image? "alpine:latest")
58+
(docker/get-login-info {})
59+
(docker/-add-token {:image ""})
60+
(try
61+
(docker/check-then-pull {:image "alpine:latest"})
62+
(catch Throwable t
63+
(logger/info t))))

0 commit comments

Comments
 (0)