-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feels pretty confusing and weird. Dockerfiles don't respect them either. I could see Bass respecting them if/when it supports directly running an image like (run (linux/redis)).
- Loading branch information
Showing
11 changed files
with
91 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
; prefetch images used by readme demo so it's not too long | ||
|
||
(run (from (linux/alpine/git) | ||
($ --version))) | ||
($ git --version))) | ||
|
||
(run (from (linux/golang) | ||
($ go version))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,51 @@ | ||
{:from-image | ||
(-> (from (linux/alpine/git :2.36.3) | ||
($ --version)) | ||
(read :raw) | ||
next) | ||
:unset-image | ||
(-> (from (linux/alpine/git :2.36.3) | ||
(with-entrypoint ($) []) | ||
($ git --version)) | ||
(read :raw) | ||
next) | ||
:from-thunk | ||
(-> (from (linux/alpine) | ||
; set an entrypoint | ||
(-> ($ sh -c "echo setting entrypoint >> out") | ||
(with-entrypoint ["sh"])) | ||
|
||
; use entrypoint | ||
($ -c "echo using entrypoint >> out") | ||
($ -c "echo using entrypoint again >> out") | ||
|
||
; erase entrypoint | ||
(-> ($ -c "echo removing entrypoint >> out") | ||
(with-entrypoint [])) | ||
|
||
; use no entryopint | ||
($ sh -c "echo no more entrypoint >> out")) | ||
(subpath ./out) | ||
(read :raw) | ||
next) | ||
:from-thunk-scratch | ||
(-> (from (linux/alpine) | ||
; set an entrypoint | ||
(with-entrypoint ($) ["sh"]) | ||
|
||
; use entrypoint | ||
($ -c "echo using entrypoint >> out") | ||
($ -c "echo using entrypoint again >> out") | ||
|
||
; erase entrypoint | ||
(with-entrypoint ($) []) | ||
|
||
; use no entryopint | ||
($ sh -c "echo no more entrypoint >> out")) | ||
(subpath ./out) | ||
(read :raw) | ||
next) | ||
} | ||
(defn tar-file [tar path] | ||
(defn find-file [stream] | ||
(let [file (next stream) | ||
info (meta file) | ||
name (path-name file)] | ||
(if (= name path) | ||
file | ||
(find-file stream)))) | ||
|
||
(find-file (read tar :tar))) | ||
|
||
(defn entrypoint [thunk] | ||
(let [config-path (-> (tar-file (export thunk) "manifest.json") | ||
(read :json) | ||
next | ||
first ; contains array of manifests | ||
:Config | ||
string->fs-path) | ||
config (-> (tar-file (export thunk) (path-name config-path)) | ||
(read :json) | ||
next | ||
:config)] | ||
(:Entrypoint config null))) | ||
|
||
(def from-image | ||
(from (linux/alpine/git :2.36.3) | ||
($ git --version))) | ||
|
||
(assert = "git version 2.36.3" (-> from-image (read :lines) next)) | ||
(assert = ["git"] (entrypoint from-image)) | ||
|
||
(def unset-image | ||
(from (linux/alpine/git :2.36.3) | ||
(with-entrypoint ($) []) | ||
($ git --version))) | ||
|
||
(assert = "git version 2.36.3" | ||
(-> unset-image (read :lines) next)) | ||
(assert null? (entrypoint unset-image)) | ||
|
||
(def set-thunk | ||
(from (linux/alpine) | ||
(with-entrypoint ($) ["sh"]))) | ||
|
||
(assert = ["sh"] (entrypoint set-thunk)) | ||
|
||
(def keeps-entrypoint | ||
(from set-thunk | ||
($ echo "Hello, world!"))) | ||
|
||
(assert = ["sh"] (entrypoint keeps-entrypoint)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters