code-server/ci/release-image
videlanicolas 3df771fbc4
Check the logged user instead of $USER (#3330)
* Check the logged user instead of $USER

Given that `sudo usermod --login "$DOCKER_USER" coder` and `sudo groupmod -n "$DOCKER_USER" coder` modify the container's disk it'll persist across restarts, but environment variables will be reset to whatever state they had at the end of `Dockerfile`. In this case, `$USER` is set to `coder`, so this branch will always be true.

By checking with the output of `whoami`, which gets it's information from `/etc/passwd`, we make sure to get the real logged user and not the one defined by $USER.

We also move `USER="$DOCKER_USER"` out of the branch, since we always want this to happen at entry-point. If we don't do this assignment, $USER will contain `coder` upon restart.

* Update entrypoint.sh

Check `$DOCKER_USER` was defined before copying it to `$USER`.
2021-05-11 10:26:38 -05:00
..
build.sh Rename container and release-container to images and release-image 2020-06-03 15:45:16 -04:00
Dockerfile Update fixuid 0.5 and add zsh to Docker image (#2925) 2021-03-22 16:15:06 -05:00
entrypoint.sh Check the logged user instead of $USER (#3330) 2021-05-11 10:26:38 -05:00