Files
babashka-pod-docker/dev/user.clj
Jim Clark 29e586ff95 Releases (#1)
Rename babashka to atomisthq
2022-12-06 22:19:23 -08:00

21 lines
670 B
Clojure

(ns user
(:require [babashka.pods :as pods]))
(pods/load-pod 'atomisthq/docker "0.1.0")
(require '[pod.atomisthq.docker :as docker])
;; parse image names using github.com/docker/distribution
;; turns golang structs into clojure maps
(docker/parse-image-name "gcr.io/whatever:tag")
;; automatically turns golang errors into Exceptions
(try
(docker/parse-image-name "gcr.io/whatever/:tag")
(catch Exception e
;; invalid reference format
(println (.getMessage e))))
;; parse dockerfiles using github.com/moby/buildkit
;; returns the Result struct transformed to a clojure map
(docker/parse-dockerfile "FROM \\\n gcr.io/whatever:tag\nCMD [\"run\"]")