Files
babashka-pod-docker/dev/user.clj

21 lines
670 B
Clojure
Raw Normal View History

2022-12-04 12:19:08 -08:00
(ns user
(:require [babashka.pods :as pods]))
(pods/load-pod 'atomisthq/docker "0.1.0")
(require '[pod.atomisthq.docker :as docker])
2022-12-04 12:19:08 -08:00
;; 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\"]")