generated from rexzhang/python-project-template
-
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(container): config in-container host,port and configfile by envi…
…ronment variables && improve entrypoint.sh
- Loading branch information
1 parent
2820cc6
commit fe91a08
Showing
2 changed files
with
41 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,44 @@ | ||
#!/bin/sh | ||
|
||
## set non-root user | ||
usermod -o -u "$UID" runner | ||
groupmod -o -g "$GID" runner | ||
# for dev | ||
if [ "$DEBUG" = "true" ]; then exec python; fi | ||
|
||
echo " | ||
------------------------ | ||
User uid: $(id -u runner) | ||
User gid: $(id -g runner) | ||
------------------------ | ||
" | ||
if [ "$1" == "asgi_webdav" ]; then | ||
|
||
echo "prepare..." | ||
chown -R runner:runner /data | ||
## set non-root user | ||
usermod -o -u "$UID" runner | ||
groupmod -o -g "$GID" runner | ||
|
||
# run server | ||
su runner -c "python -m asgi_webdav -H 0.0.0.0 -c /data/webdav.json --logging-no-display-datetime --logging-no-use-colors" | ||
echo " | ||
------------------------ | ||
User uid: $(id -u runner) | ||
User gid: $(id -g runner) | ||
------------------------ | ||
" | ||
|
||
# for dev | ||
if [ "$DEBUG" = "true" ]; then python; fi | ||
echo "prepare..." | ||
chown -R runner:runner /data | ||
|
||
if [ -z "$WEBDAV_HOST" ]; then | ||
WEBDAV_HOST="0.0.0.0" | ||
fi | ||
|
||
if [ -z "$WEBDAV_PORT" ]; then | ||
WEBDAV_PORT="8000" | ||
fi | ||
|
||
if [ -z "$WEBDAV_CONFIGFILE" ]; then | ||
WEBDAV_CONFIGFILE="/data/webdav.json" | ||
fi | ||
|
||
exec su-exec runner \ | ||
python -m asgi_webdav \ | ||
--host "$WEBDAV_HOST" \ | ||
--port "$WEBDAV_PORT" \ | ||
--config "$WEBDAV_CONFIGFILE" \ | ||
--logging-no-display-datetime \ | ||
--logging-no-use-colors | ||
|
||
fi | ||
|
||
exec $* |