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.
21 lines
397 B
Ruby
21 lines
397 B
Ruby
class Kamal::Commands::Builder::Native < Kamal::Commands::Builder::Base
|
|
def create
|
|
# No-op on native without cache
|
|
end
|
|
|
|
def remove
|
|
# No-op on native without cache
|
|
end
|
|
|
|
def info
|
|
# No-op on native
|
|
end
|
|
|
|
def push
|
|
combine \
|
|
docker(:build, *build_options, build_context),
|
|
docker(:push, config.absolute_image),
|
|
docker(:push, config.latest_image)
|
|
end
|
|
end
|