Docker does not respect the .dockerignore file when building from a tar. Instead by default we'll make a local clone into a tmp directory and build from there. Subsequent builds will reset the clone to match the checkout. Compared to building directly in the repo, we'll have reproducible builds. Compared to using a git archive: 1. .dockerignore is respected 2. We'll have faster builds - docker can be smarter about caching the build context on subsequent builds from a directory To build from the repo directly, set the build context to "." in the config. If there are uncommitted changes, we'll warn about them either being included or ignored depending on whether we build from the clone.
24 lines
320 B
Ruby
24 lines
320 B
Ruby
module Kamal::Git
|
|
extend self
|
|
|
|
def used?
|
|
system("git rev-parse")
|
|
end
|
|
|
|
def user_name
|
|
`git config user.name`.strip
|
|
end
|
|
|
|
def revision
|
|
`git rev-parse HEAD`.strip
|
|
end
|
|
|
|
def uncommitted_changes
|
|
`git status --porcelain`.strip
|
|
end
|
|
|
|
def root
|
|
`git rev-parse --show-toplevel`.strip
|
|
end
|
|
end
|