Skip to content

Commit

Permalink
release 0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
minhtuannguyen committed Jul 17, 2016
1 parent 60700d1 commit bb6b2a0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
23 changes: 14 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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))))
```


Expand Down
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -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"
Expand Down

0 comments on commit bb6b2a0

Please sign in to comment.