diff --git a/.gitignore b/.gitignore index 9220ff2..0539612 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,7 @@ /.clj-kondo/ /.cpcache/ /.lsp/ +/pod-babashka-docker +/pod-babashka-docker-0.1.0-macos-aarch64.zip +/pod-atomisthq-docker +/pod-atomisthq-docker-0.1.0-macos-aarch64.zip diff --git a/README.md b/README.md index 38ccf0e..43a87d9 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,7 @@ This is a [babashka pod](https://github.com/babashka/pods) that binds some golan #_(pods/load-pod "./parser") ;; load-pod will create this namespace with two vars -(require '[pod.babashka.docker :as docker]) +(require '[pod.atomisthq.docker :as docker]) ;; parse image names using github.com/docker/distribution ;; turns golang structs into clojure maps @@ -31,12 +31,14 @@ This is a [babashka pod](https://github.com/babashka/pods) that binds some golan (docker/parse-dockerfile "FROM \\\n gcr.io/whatever:tag\nCMD [\"run\"]") ``` +Loading `'atomisthq/docker` from the pod registry will download the binary into `${user.home}/.babashka/pods/registry` (the `$BABASHKA_PODS_DIR` environment variable will be used if it exists). + ## Building To build the golang `parser` binary locally, run `go build`. ```bash -go build +go build -o pod-babashka-docker ``` ## Contributing diff --git a/bb.edn b/bb.edn new file mode 100644 index 0000000..e369c6a --- /dev/null +++ b/bb.edn @@ -0,0 +1,15 @@ +{:tasks + {:requires ([babashka.fs :as fs]) + :init (do + (def n "pod-atomisthq-docker") + (def os "macos") + (def version "0.1.0")) + build (shell (format "go build -o %s" n)) + aarch64 (do + (shell (format "zip %s-%s-%s-%s.zip %s" n version os "aarch64" n) {})) + x86 (do + (shell (format "zip %s-%s-%s-%s.zip %s" n version os "x86_64" n) {})) + linux-x86 + (do + (shell (format "zip %s-%s-%s-%s.zip %s" n version "linux" "amd64" n) {}))}} + diff --git a/dev/user.clj b/dev/user.clj index 4aefaea..a0cf059 100644 --- a/dev/user.clj +++ b/dev/user.clj @@ -2,7 +2,7 @@ (:require [babashka.pods :as pods])) (pods/load-pod 'atomisthq/docker "0.1.0") -(require '[pod.babashka.docker :as docker]) +(require '[pod.atomisthq.docker :as docker]) ;; parse image names using github.com/docker/distribution ;; turns golang structs into clojure maps diff --git a/docker/ops.go b/docker/ops.go index 6e6ba75..b270229 100644 --- a/docker/ops.go +++ b/docker/ops.go @@ -60,7 +60,7 @@ func ProcessMessage(message *babashka.Message) (any, error) { Format: "json", Namespaces: []babashka.Namespace{ { - Name: "pod.babashka.docker", + Name: "pod.atomisthq.docker", Vars: []babashka.Var{ { Name: "parse-image-name", @@ -74,14 +74,14 @@ func ProcessMessage(message *babashka.Message) (any, error) { }, nil case "invoke": switch message.Var { - case "pod.babashka.docker/parse-image-name": + case "pod.atomisthq.docker/parse-image-name": args := []string{} if err := json.Unmarshal([]byte(message.Args), &args); err != nil { return nil, err } return parse_uri(args[0]) - case "pod.babashka.docker/parse-dockerfile": + case "pod.atomisthq.docker/parse-dockerfile": args := []string{} if err := json.Unmarshal([]byte(message.Args), &args); err != nil { return nil, err