Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop using the root user for test/cli containers #416

Open
acbramley opened this issue Jul 24, 2024 · 2 comments
Open

Stop using the root user for test/cli containers #416

acbramley opened this issue Jul 24, 2024 · 2 comments

Comments

@acbramley
Copy link

acbramley commented Jul 24, 2024

Locally, when running cli/test containers the user that is used is root. This means when running things like config export, or composer install from inside the container (which is required when your host uses a different PHP version since govcms is currently constrained to PHP 8.1) all files resulting from the commands are owned by root:root this then locks them out from being editable from your host (i.e in an IDE)

This leads to a very frustrating experience where multiple times a day I'm having to chown directories on my host machine just to make changes.

Skpr images for example use a skpr user https://github.com/skpr/image-php/blob/main/cli/Dockerfile#L50

This user uses uid and gid of 1000 to align them with linux users

@acbramley
Copy link
Author

@steveworley
Copy link
Contributor

steveworley commented Aug 29, 2024

Hey @acbramley — given the constraints with our base images, which create system configuration files through their entrypoints, running the container as a different user is not supported at this time

The best approach to make this workflow more manageable would be to create an ahoy command that would automate the export and chown for you.

# custom/ahoy.yml

commands:
  config:export: |
    docker compose exec cli drush config:export
    chown -R ${UID}:${GID} config/sync

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants