Open gaetansnl opened 4 years ago
Thanks for logging this.
I'm working with docker-compose and also seeing this compose.yml
abroll-base:
stdin_open: true
tty: true
build:
context: ../
dockerfile: dev/dockerfiles/abroll-base.Dockerfile
image: abroll-base
Tiltfile
docker_build(
# Image name - must match the image in the docker-compose file
'abroll-base',
# Docker context
'.',
dockerfile='dev/dockerfiles/abroll-base.Dockerfile',
only=[
'./package.json',
'./yarn.lock',
'./lerna.json',
'./tsconfig.json',
'./tsconfig.build.json',
'./babel.config.js',
],
)
saving a file in the repo will cause that file to show in the 'EDITED HISTORY' within Tilt cli
saving a file in the repo will cause that file to show in the 'EDITED HISTORY' within Tilt cli
Could you grab the output of tilt dump engine
after this happens and share it? (publicly or privately)
Here is a gist of that command ran right after I changed a file. .env
abroll-pkgs
picked up the change
docker_build(
'abroll-pkgs',
'.',
dockerfile='dev/dockerfiles/abroll-pkgs.Dockerfile',
only=[
'./packages',
],
ignore=[
'./apps',
'./configs',
],
)
But only abroll-config
should have
docker_build(
'abroll-config',
'.',
dockerfile='dev/dockerfiles/abroll-config.Dockerfile',
only=[
'./configs',
],
ignore=[
'./apps',
'./packages',
],
)
Now in the docker-compose abroll-pkgs
does depend_on abroll-config
version: '3.7'
services:
abroll-base:
stdin_open: true
tty: true
build:
context: ../
dockerfile: dev/dockerfiles/abroll-base.Dockerfile
image: abroll-base
abroll-config:
stdin_open: true
tty: true
depends_on:
- abroll-base
build:
context: ../
dockerfile: dev/dockerfiles/abroll-config.Dockerfile
image: abroll-config
abroll-pkgs:
stdin_open: true
tty: true
depends_on:
- abroll-base
- abroll-config
build:
context: ../
dockerfile: dev/dockerfiles/abroll-pkgs.Dockerfile
image: abroll-pkgs
Sorry if it's so messy and maybe full of noise?. If there is a way to clean it up for you, let me know https://gist.github.com/doogledor/8a8437486f7d3cf6c5b73db32db182c8
Now in the docker-compose
abroll-pkgs
does depend_onabroll-config
Ah! This explains things. Tilt will rebuild an image when a file in its context changes, or when one of its base images changes.
Tilt's execution model is currently (and unfortunately for this issue) a bit simpler than what you're describing - Tilt sees .env change, so it rebuilds abroll-config
. It doesn't know what files in abroll-config
have changed as a result of that build, just that there was a rebuild, so it then rebuilds any other images that depend on abroll-config
, i.e., abroll-pkgs
.
The first two options I'd look into (though it's hard to say if either is better or even feasible without knowing about a specific setup):
Thank you landism for this advice. Coming multistage docker world, I was forcing something that wasn't needed.
Having 1 Dockerfile that does all the copying, shared between the various apps within the monorepo & using specific docker_builds(
with live_update
for each of the applications seems to be the way to go.
Hello Everyone
I have some folder ignored in
.dockerignore
for example/dist
. And I noticed that whendist
is created, tilt detect the change, even if the folder is ignored.