branch: elpa/dockerfile-mode commit 4d3ccfd569e1d79ef77af28c8daa9d1ddf8735e9 Merge: fadac401c8 a532e30371 Author: Rohan Singh <ro...@washington.edu> Commit: Rohan Singh <ro...@washington.edu>
Merge pull request #9 from Silex/master Add support for custom Dockerfiles --- README.md | 12 ++++++++---- dockerfile-mode.el | 6 +++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c3c7fb8501..d389f044a9 100644 --- a/README.md +++ b/README.md @@ -4,9 +4,11 @@ Known to work with Emacs 24 and later A Dockerfile mode for emacs - (add-to-list 'load-path "/your/path/to/dockerfile-mode/") - (require 'dockerfile-mode) - (add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +``` emacs-lisp +(add-to-list 'load-path "/your/path/to/dockerfile-mode/") +(require 'dockerfile-mode) +(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +``` Adds syntax highlighting as well as the ability to build the image directly (C-c C-b) from the buffer. @@ -14,6 +16,8 @@ directly (C-c C-b) from the buffer. You can specify the image name in the file itself by adding a line like this at the top of your Dockerfile. - ## -*- docker-image-name: "your-image-name-here" -*- +``` emacs-lisp +## -*- docker-image-name: "your-image-name-here" -*- +``` If you don't, you'll be prompted for an image name each time you build. diff --git a/dockerfile-mode.el b/dockerfile-mode.el index 468d2f6edc..dba2fc37a0 100644 --- a/dockerfile-mode.el +++ b/dockerfile-mode.el @@ -82,8 +82,8 @@ (list docker-image-name))) (save-buffer) (if (stringp image-name) - (shell-command - (concat (if dockerfile-use-sudo "sudo " "") "docker build -t " image-name " " (file-name-directory (buffer-file-name)) "&") + (async-shell-command + (format "%s docker build -t %s -f %s %s" (if dockerfile-use-sudo "sudo" "") image-name (buffer-file-name) (file-name-directory (buffer-file-name))) "*docker-build-output*") (print "docker-image-name must be a string, consider surrounding it with double quotes"))) @@ -107,7 +107,7 @@ (setq local-abbrev-table dockerfile-mode-abbrev-table)) ;;;###autoload -(add-to-list 'auto-mode-alist '("Dockerfile\\'" . dockerfile-mode)) +(add-to-list 'auto-mode-alist '("Dockerfile.*\\'" . dockerfile-mode)) (provide 'dockerfile-mode)