tilt-dev / tilt

Define your dev environment as code. For microservice apps on Kubernetes.
https://tilt.dev/
Apache License 2.0
7.6k stars 299 forks source link

Force pull with docker_compose #5613

Open scalp42 opened 2 years ago

scalp42 commented 2 years ago

Describe the Feature You Want

We currently using latest tags on every image with docker-compose. We'd like to be able to "force pull" as even if we rebuild the image with Tilt using docker_build, docker-compose won't recreate the container / pull the latest changes for the latest tag.

Currently we're thinking of doing a random tag somehow and then override the tag:

my_service_docker_tag = local('printf $RANDOM')

docker_build("my_service:%s" % my_service_docker_tag)

# NOTE: to override by hand
override_image = { 'admin': {'image': "my_service:%s" % my_service_docker_tag } }
docker_compose(['./docker-compose.yml', encode_yaml({'services': override_image})])

The problem is that it doesn't work unless we save the actual docker-compose YAML file and then the containers get recreated.

Thanks in advance for the help or insights, feels like we're missing something.

landism commented 2 years ago

The desired behavior you're describing is the way we hope/expect Tilt to behave currently, so I'd probably call this a bug.

I didn't have any luck reproing it on one of our sample projects though:

  1. git clone https://github.com/tilt-dev/servantes && servantes
  2. tilt up -f Tiltfile.dc vigoda
  3. edit vigoda/main.go

Tilt rebuilds the vigoda_for_dc image and restarts the service.

(the docker-compose.yaml at HEAD just says "image: vigoda_for_dc", but it also works if I change it to "image: vigoda_for_dc:latest".

Any idea what I might be missing to repro the problem you're describing?