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

Switch to appuser to avoid root #43

Merged
merged 29 commits into from
Jun 15, 2023
Merged

Switch to appuser to avoid root #43

merged 29 commits into from
Jun 15, 2023

Conversation

btlogy
Copy link
Contributor

@btlogy btlogy commented May 26, 2023

Depends on #40 and #42
Close #34

The application is still installed via pip as root, but the command run as non-root.
The appuser is created inside the container with uid=1000 and gid=1000 by default.
But one can change those default either:

  • by re-building the image with --build-arg uid=...
  • or change the user runtime with the env. variable (e.g.: MW_MAILBOX_UID and MW_RELAY_UID)

The later is the option now used to test the image in the workflow because the GH runner used uid=1001.

btlogy added 3 commits May 26, 2023 23:05
* avoid git package - unused since #30
* re-order and document steps
* use environment variables as parameter
* expose ports

Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
@btlogy btlogy self-assigned this May 27, 2023
Signed-off-by: Benoit Donneaux <[email protected]>
btlogy added 20 commits May 27, 2023 17:44
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
Signed-off-by: Benoit Donneaux <[email protected]>
@btlogy btlogy force-pushed the 34.rootless branch 2 times, most recently from 4ea3a8d to 423308a Compare May 28, 2023 21:41
Signed-off-by: Benoit Donneaux <[email protected]>
@btlogy btlogy marked this pull request as ready for review May 29, 2023 23:40
@btlogy btlogy requested a review from c-chroniko May 30, 2023 09:21
@btlogy
Copy link
Contributor Author

btlogy commented May 30, 2023

@c-chroniko : I've used some of your previous feedback here (for groupadd and useradd).
Hopefully it's a bit more to the point.
Let me know what you think about this.

@btlogy btlogy added the enhancement New feature or request label May 30, 2023
@c-chroniko
Copy link

Do the changes in this PR only address the subject of the request, or does it include other stylistic changes? I'm having trouble going through such a large diff and identifying whether it's successful in its goal.

@btlogy
Copy link
Contributor Author

btlogy commented May 31, 2023

Do the changes in this PR only address the subject of the request, or does it include other stylistic changes? I'm having trouble going through such a large diff and identifying whether it's successful in its goal.

My apologies: You are right to think this patche is too big!
This branch his based on 2 others which are not yet in main.
I should have wait for #40 and #42 to be merged before asking a review here.
Or is there a better way to do this?

@btlogy
Copy link
Contributor Author

btlogy commented May 31, 2023

@c-chroniko: this comparison is diffing only what this specific PR is about: reworking the Dockerfiles to create the app user+group and adapt the composer and workflow accordingly.

I don't think I can rebase this branch on main w/o braking the build and conflicting other pending PR...

Maybe you can review #40 and then #42 after #40 will be merged?

@btlogy btlogy marked this pull request as draft May 31, 2023 21:24
@btlogy
Copy link
Contributor Author

btlogy commented May 31, 2023

Back to draft to avoid further confusion.
Sorry for the mess @c-chroniko

@btlogy btlogy marked this pull request as ready for review June 6, 2023 20:52
@btlogy
Copy link
Contributor Author

btlogy commented Jun 6, 2023

@c-chroniko : this PR is clean now.
Hopefully way much easier to review :-)
Sorry again.

Copy link

@c-chroniko c-chroniko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@btlogy btlogy merged commit 7540d75 into main Jun 15, 2023
@btlogy btlogy deleted the 34.rootless branch June 15, 2023 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docker containers sould run in rootless mode
2 participants