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

non root user in docker entry #162

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Conversation

morten-spiegel
Copy link

No description provided.

Copy link
Member

@gabriel-v gabriel-v left a comment

Choose a reason for hiding this comment

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

Let's run migrate as non-root too, this way we won't run any escalated python. So, in the entrypoint:

chown ...
gosu $USER_NAME ./manage.py migrate 
gosu $USER_NAME "$@"

exit 1
fi

./manage.py initialize
Copy link
Member

Choose a reason for hiding this comment

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

This command only runs migrate (it used to do a lot more) - so you can remove that file and replace this line with ./manage.py migrate.

#!/bin/bash -ex

if [[ ! -d "$DATA_DIR" ]]; then
exit 1
Copy link
Member

Choose a reason for hiding this comment

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

Does this ever happen? I mean sure, if you don't mount the directory, but we do mount it. I think you can remove this check, let it crash later naturally when doing migrate.


./manage.py initialize

chown -R $UID:$GID $DATA_DIR
Copy link
Member

Choose a reason for hiding this comment

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

For this service, since it only has one file on it, it's OK to always run a chown -R. For other repositories that may have a lot of data under the volume, you can't use -R every container boot because it would take a lot of time

Dockerfile Outdated
&& apt-get clean && rm -rf /var/lib/apt/lists/*

ARG UNAME=liquid
Copy link
Member

Choose a reason for hiding this comment

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

call this arg $USER_NAME too so it has the same name as the env below

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

Successfully merging this pull request may close these issues.

2 participants