changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > core / lisp/lib/skel/comp/container.lisp

changeset 698: 96958d3eb5b0
parent: cc89b337384b
author: Richard Westhaver <ellis@rwest.io>
date: Fri, 04 Oct 2024 22:04:59 -0400
permissions: -rw-r--r--
description: fixes
1 ;;; container.lisp --- Containerfile Components
2 
3 ;; Containerfile skel components.
4 
5 ;;; Commentary:
6 
7 ;; By convention we consider any file with base-name 'Containerfile'
8 ;; (case-sensitive) to be an OCI Containerfile. Extension is used as the name
9 ;; of the containerfile, or if absent defaults to the directory name.
10 
11 ;;; Code:
12 (in-package :skel/comp/container)
13 
14 (defclass sk-containerfile (sk-component containerfile)
15  ())
16 
17 (defmethod print-object ((object sk-containerfile) stream)
18  (print-unreadable-object (object stream :type t)
19  (format stream "~A" (file-namestring (containerfile-path object)))))
20 
21 (defmethod sk-convert ((self containerfile))
22  (let ((self (change-class self 'sk-containerfile)))
23  (update-id self)
24  self))
25 
26 (defmethod sk-load-component ((kind (eql :containerfile))
27  (name pathname)
28  &optional (path *default-pathname-defaults*))
29  (declare (ignore kind))
30  (sk-convert (deserialize
31  (make-pathname :name *default-containerfile* :type (namestring name)
32  :directory (namestring path))
33  :containerfile)))
34 
35 (defmethod sk-write-file ((self sk-containerfile) &key path)
36  (serde self (pathname (or path (containerfile-path self)))))
37 
38 (defmethod sk-read-file ((self sk-containerfile) path)
39  (sk-load-component :containerfile path))
40 
41 (defmethod sk-path ((self sk-containerfile))
42  (containerfile-path self))
43 
44 (defmethod sk-build ((self sk-containerfile) &key with-client no-cache tag)
45  (typecase with-client
46  (null (apply 'pod::run-podman (flatten (concatenate 'list
47  `("build" "-f"
48  ,(sk-path self)
49  ,@(when no-cache (list "--no-cache")))
50  (when tag (list "-t" tag ))))))
51  ;; iff == t
52  (boolean
53  (with-libpod-client (c)
54  (libpod-request-json c "containers/json")
55  (nyi! "need to implement containerfile libpod request method")))
56  ;; else
57  (t (with-libpod-client (c with-client)
58  (nyi! "todo")))))