This step is optional, though if provided, it must come at the beginning of the live_update call. stuff.txt => doesn’t match a sync statement OR the docker_build context nothing happens server/some_file.txt => doesn’t match any sync statements, but does match the docker_build context instead of a Live Update, Tilt performs a Docker Build server/package.json => synced to /app/web/package.json server/src/A.txt => synced to /app/A.txt Let’s reviewįor instance, take the following sync statements:ĭocker_build ( 'my-img', './server', live_update = ) (Tilt will watch it if it’s in a docker_ntext or custom_ps). The rule of thumb is: if Tilt is watching it, you can sync it. FROM’s–the red image in the common directory.) (In the diagram above, Tilt is building two images the yellow image in the server1 directory depends on–i.e. If you have multiple Docker images that depend on each other, you can sync files from anywhere within the contexts of any of the images.
#Tilt to live vs tilt to live 2 full
(Want to be more selective in which files do/don’t kick off full builds? Check out context filters for docker_build.) An example of 'sync' used with dependent Docker images
#Tilt to live vs tilt to live 2 how to
A change to any of the yellow files will kick off a full Docker build + deploy, because they’re part of the Docker context but we don’t have instructions on how to Live Update them. A change to any of the green files will kick off a Live Update, because they match a sync step. A valid use of 'sync' (all sync'd files are subsets of docker_ntext)Ībove is an example of a valid syncs. To put it another way: there’s no way for those files to get into the container in the first place, because they would never be included in the Docker build. The sync above is invalid, because it attempts to sync files that we’re not even watching (seen here highlighted in blue). (If you’re using custom_build, all of the above applies, only with deps in place of context.) Let’s look at some examples: An illegal 'sync': attempting to sync files that aren't included in the docker_build context Your sync’d local paths must fall within that context. In the case of a docker_build call, Tilt watches the directory that you pass as context. When you tell Tilt how to build an image, you specify some set of files to watch. (This includes deleting the file remotely if it is deleted locally.) What files can I sync? How are builds triggered? Tilt will only run a Live Update if it detects a change to one or more files matching a sync step.Ī sync call takes two args: the local path of a file/directory, and the remote path to which Tilt should sync that file/directory if it changes. (For this reason, we’ll discuss them first, even though they may be preceeded by one or more fall_back_on steps in a Tiltfile.) Sync steps are the backbone of a Live Update. Sync_src = sync ( './source', '/app/src' ) sync_static = sync ( './static', '/app/static' ) docker_build ( 'my-img', '.', live_update = )Īs part of Tiltfile validation, we check that all of the LiveUpdateSteps you’ve created have been used in at least one Live Update call.
That means that something like this is perfectly valid syntax: if the run specifies one or more triggers, execute the command iff any changed files match the given triggersĮach of the functions above returns a LiveUpdateStep – an object like any other, i.e.copy any changed files according to sync steps.Otherwise, if it matches any of the local paths in sync steps, a live update will be executed as follows:.If it matches any of the files in a fall_back_on step, we will fall back to a full rebuild + deploy (i.e.When you tilt up, your initial build will be a full build-i.e., the specified Docker build or Custom build. The list of LiveUpdateSteps must be, in order: Live_update takes a list of LiveUpdateSteps that tell Tilt how to update a running container in place (instead of paying the cost of building a new image and redeploying). When specifying how to build an image (via docker_build() or custom_build()), you may optionally pass the live_update argument. If you’re lookingįor sample projects and examples for your project, see: This document is a technical specification of live_update. Live Update optimizes your setup to get updates down from minutes to seconds.