-
Notifications
You must be signed in to change notification settings - Fork 2
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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 |
There was a problem hiding this comment.
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
.
docker-entrypoint.sh
Outdated
#!/bin/bash -ex | ||
|
||
if [[ ! -d "$DATA_DIR" ]]; then | ||
exit 1 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
No description provided.