-
Notifications
You must be signed in to change notification settings - Fork 500
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The
build dev
command warns about untracked and uncommitted files
so there's a complete picture of what is being packaged that's not in git.
- Loading branch information
1 parent
2127f17
commit 7c75aa5
Showing
3 changed files
with
56 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
require "tempfile" | ||
require "open3" | ||
|
||
module Kamal::Docker | ||
extend self | ||
BUILD_CHECK_TAG = "kamal-local-build-check" | ||
|
||
def included_files | ||
Tempfile.create do |dockerfile| | ||
dockerfile.write(<<~DOCKERFILE) | ||
FROM busybox | ||
COPY . app | ||
WORKDIR app | ||
CMD find . -type f | sed "s|^\./||" | ||
DOCKERFILE | ||
dockerfile.close | ||
|
||
cmd = "docker buildx build -t=#{BUILD_CHECK_TAG} -f=#{dockerfile.path} ." | ||
system(cmd) || raise("failed to build check image") | ||
end | ||
|
||
cmd = "docker run --rm #{BUILD_CHECK_TAG}" | ||
out, err, status = Open3.capture3(cmd) | ||
unless status | ||
raise "failed to run check image:\n#{err}" | ||
end | ||
|
||
out.lines.map(&:strip) | ||
end | ||
end |
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