I would like to run live update as oriented on https://github.com/windmilleng/tilt-example-java/blob/master/4-recommended/Tiltfile#L19-L28 but with buildah instead of Docker. I tried to add using the following method:
custom_build(
'backend-java-image',
'./build/jar',
'buildah bud -t $EXPECTED_REF . && buildah push $EXPECTED_REF $EXPECTED_REF',
['./backend-java-image'],
skips_local_docker = True,
live_update = [
sync('./build/jar/BOOT-INF/lib', '/app/lib'),
sync('./build/jar/META-INF', '/app/META-INF'),
sync('./build/jar/BOOT-INF/classes', '/app'),
],
entrypoint = 'find . | entr -r java -noverify -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005 -cp .:./lib/* br.com.example.ExampleApplication')
But the following error was thrown:
Successfully loaded Tiltfile (3.991286ms)
Traceback (most recent call last):
Tiltfile:10:13: in <toplevel>
<builtin>: in custom_build
Error: custom_build: for parameter deps: got string, want list
If we remove './build/jar' parameter, the following error is thrown:
URL: http://localhost:5005/ • http://localhost:8000/
ERROR:
STEP 5: ADD BOOT-INF/lib /app/lib
error building at STEP "ADD BOOT-INF/lib /app/lib": no files found matching
"app/BOOT-INF/lib": no such file or directory
level=error msg="exit status 1"
Looks that custom_build doesn't have the parameter to specify the source directory in order to live update work.
https://github.com/windmilleng/tilt/blob/772d5b0c12abd66fea6dc72127442ad5ad9932be/internal/tiltfile/tiltfile_test.go#L2078
https://docs.tilt.dev/custom_build.html#buildah-or-any-image-builder-indepdendent-of-docker
+1
I've used buildah before, let me take a poke at this, I think this might be an easy misunderstanding. In particular, from
https://docs.tilt.dev/custom_build.html#buildah-or-any-image-builder-indepdendent-of-docker
it looks like you have the parameters in the wrong order.
OK, here's an example Tiltfile that I just pushed up.
https://github.com/windmilleng/tilt-example-java/blob/nicks/buildah/4-recommended/Tiltfile
Some notes:
build/jar, so the Docker build context in your buildah invocation needs to look like: buildah bud -t $EXPECTED_REF build/jarskips_local_docker=True right![registries.insecure]
registries = ['localhost:32000', 'localhost:5000']
to /etc/containers/registries.conf, though I'm not an expert on buildah configuration and this might be different on different platforms.
I think buildah_build would make a cool Tilt extension! https://github.com/windmilleng/tilt-extensions
OK, here's an example Tiltfile that I just pushed up.
https://github.com/windmilleng/tilt-example-java/blob/nicks/buildah/4-recommended/TiltfileSome notes:
- The Docker build context is
build/jar, so the Docker build context in your buildah invocation needs to look like:buildah bud -t $EXPECTED_REF build/jar- You got the
skips_local_docker=Trueright!- I needed to do some configuration work to make sure local registries (like Kind or Microk8s) work correctly with Buildah, this involved adding:
[registries.insecure] registries = ['localhost:32000', 'localhost:5000']to
/etc/containers/registries.conf, though I'm not an expert on buildah configuration and this might be different on different platforms.I think
buildah_buildwould make a cool Tilt extension! https://github.com/windmilleng/tilt-extensions
Thanks a lot Man! Worked like a charm.
I think
buildah_buildwould make a cool Tilt extension! https://github.com/windmilleng/tilt-extensions.
Yeah, I would be awesome, hope we can contribute and add it in the future.
Thanks a lot Nick.
Most helpful comment
OK, here's an example Tiltfile that I just pushed up.
https://github.com/windmilleng/tilt-example-java/blob/nicks/buildah/4-recommended/Tiltfile
Some notes:
build/jar, so the Docker build context in your buildah invocation needs to look like:buildah bud -t $EXPECTED_REF build/jarskips_local_docker=Trueright!to
/etc/containers/registries.conf, though I'm not an expert on buildah configuration and this might be different on different platforms.I think
buildah_buildwould make a cool Tilt extension! https://github.com/windmilleng/tilt-extensions