4
.gitignore
vendored
4
.gitignore
vendored
@@ -2,3 +2,7 @@
|
|||||||
/.clj-kondo/
|
/.clj-kondo/
|
||||||
/.cpcache/
|
/.cpcache/
|
||||||
/.lsp/
|
/.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
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ This is a [babashka pod](https://github.com/babashka/pods) that binds some golan
|
|||||||
#_(pods/load-pod "./parser")
|
#_(pods/load-pod "./parser")
|
||||||
|
|
||||||
;; load-pod will create this namespace with two vars
|
;; 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
|
;; parse image names using github.com/docker/distribution
|
||||||
;; turns golang structs into clojure maps
|
;; 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\"]")
|
(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
|
## Building
|
||||||
|
|
||||||
To build the golang `parser` binary locally, run `go build`.
|
To build the golang `parser` binary locally, run `go build`.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
go build
|
go build -o pod-babashka-docker
|
||||||
```
|
```
|
||||||
|
|
||||||
## Contributing
|
## Contributing
|
||||||
|
|||||||
15
bb.edn
Normal file
15
bb.edn
Normal file
@@ -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) {}))}}
|
||||||
|
|
||||||
@@ -2,7 +2,7 @@
|
|||||||
(:require [babashka.pods :as pods]))
|
(:require [babashka.pods :as pods]))
|
||||||
|
|
||||||
(pods/load-pod 'atomisthq/docker "0.1.0")
|
(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
|
;; parse image names using github.com/docker/distribution
|
||||||
;; turns golang structs into clojure maps
|
;; turns golang structs into clojure maps
|
||||||
|
|||||||
@@ -60,7 +60,7 @@ func ProcessMessage(message *babashka.Message) (any, error) {
|
|||||||
Format: "json",
|
Format: "json",
|
||||||
Namespaces: []babashka.Namespace{
|
Namespaces: []babashka.Namespace{
|
||||||
{
|
{
|
||||||
Name: "pod.babashka.docker",
|
Name: "pod.atomisthq.docker",
|
||||||
Vars: []babashka.Var{
|
Vars: []babashka.Var{
|
||||||
{
|
{
|
||||||
Name: "parse-image-name",
|
Name: "parse-image-name",
|
||||||
@@ -74,14 +74,14 @@ func ProcessMessage(message *babashka.Message) (any, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
case "invoke":
|
case "invoke":
|
||||||
switch message.Var {
|
switch message.Var {
|
||||||
case "pod.babashka.docker/parse-image-name":
|
case "pod.atomisthq.docker/parse-image-name":
|
||||||
args := []string{}
|
args := []string{}
|
||||||
if err := json.Unmarshal([]byte(message.Args), &args); err != nil {
|
if err := json.Unmarshal([]byte(message.Args), &args); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return parse_uri(args[0])
|
return parse_uri(args[0])
|
||||||
case "pod.babashka.docker/parse-dockerfile":
|
case "pod.atomisthq.docker/parse-dockerfile":
|
||||||
args := []string{}
|
args := []string{}
|
||||||
if err := json.Unmarshal([]byte(message.Args), &args); err != nil {
|
if err := json.Unmarshal([]byte(message.Args), &args); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
Reference in New Issue
Block a user