tilt-dev / tilt

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

Run live_sync’s sync/run as a specific user #5197

Open rwoll opened 2 years ago

rwoll commented 2 years ago

Describe the Feature You Want

Allow explicitly declaring which user each sync/run command in Docker live_sync should run as.

Our image has a mix of root-owned and non-root files.

Currently, it looks like sync/run use the last USER in the Dockerfile. This prevents you from syncing in files to root owned locations if your container is running with a non-root user.

I'd like to be able to write something like the following so I don't have to install sudo into the container:

sync(…, user="root"),
run(…, user="root")

Why Do You Want This?

We'd like to minimize modifying the original docker container image too much. On the docker CLI you can specify a user argument.

hyu commented 2 years ago

Hi @rwoll, thanks for the feature request. That's a good description of the functionality you're looking for. You want an additional user arg for the sync and run commands that work with Tilt's live_update functionality.

Just to make sure I understand your constraints — you're avoiding the workaround of having a separate Dockerfile for dev, e.g., so your dev image has root access? (Assuming that you want to avoid modifying the original Docker container image to make dev and prod use consistent config?)

rwoll commented 2 years ago

Hi @rwoll, thanks for the feature request. That's a good description of the functionality you're looking for. You want an additional user arg for the sync and run commands that work with Tilt's live_update functionality.

Just to make sure I understand your constraints — you're avoiding the workaround of having a separate Dockerfile for dev, e.g., so your dev image has root access? (Assuming that you want to avoid modifying the original Docker container image to make dev and prod use consistent config?)

Correct! We'd like to share as much as possible. We do override some things via docker_build_sub, but the closer they can be the better!