diff --git a/README.md b/README.md index d5e181e..1c363c6 100644 --- a/README.md +++ b/README.md @@ -18,13 +18,14 @@ To generate a Dockerfile from spec: (defn- heap [heap] (str "-Xmx=" heap "m ")) (defn- port [port] (str "-Dport=" port)) -(d/write-dockerfile! [:from "java:8" - :run (lazy-seq ["mkdir" "-p" "/var/opt/folder"]) - :user "nobody" - :add ["from" "to"] - :workdir "/var/opt/folder" - :cmd ["java" (heap 512) (port 512) ["-jar" "artifact.jar"]]] - "path/to/dockerfile") +(-> [:from "java:8" + :run (lazy-seq ["mkdir" "-p" "/var/opt/folder"]) + :user "nobody" + :add ["from" "to"] + :workdir "/var/opt/folder" + :cmd ["java" (heap 512) (port 512) ["-jar" "artifact.jar"]]] + (d/new-dockerfile) + (d/write! "path/to/dockerfile")) ``` The content of the generated Dockerfile will be: @@ -44,10 +45,14 @@ To validate a dockerfile spec: (:require [cljocker.hh.dsl.docker :as d]) (is (= [:valid] - (d/validate [:from "image" :cmd "echo"]))) + (-> [:from "image" :cmd "echo"] + (d/new-dockerfile) + (d/validate)))) (is (= [:invalid "first instruction must be FROM"] - (d/validate [:cmd "echo"]))) + (-> [:cmd "echo"] + (d/new-dockerfile) + (d/validate)))) ``` diff --git a/project.clj b/project.clj index 66be106..1fc33cd 100644 --- a/project.clj +++ b/project.clj @@ -1,4 +1,4 @@ -(defproject minhtuannguyen/cljocker "0.1.7-SNAPSHOT" +(defproject minhtuannguyen/cljocker "0.1.7" :description "a dockerfile dsl written in clojure" :url "" :license {:name "Eclipse Public License"