Skip to content

Commit

Permalink
change entrypoint to final test
Browse files Browse the repository at this point in the history
  • Loading branch information
adenntumba committed Mar 4, 2024
1 parent a3c46a0 commit 9031f75
Showing 1 changed file with 38 additions and 46 deletions.
84 changes: 38 additions & 46 deletions docker/start
Original file line number Diff line number Diff line change
@@ -1,46 +1,46 @@
#!/bin/bash
!/bin/bash

# export GUNICORN_APP=${GUNICORN_APP:-"apip.wsgi"}
# # export CELERY_APP=${CELERY_APP:-"apiphantom"}
# export GUNICORN_CONF=${GUNICORN_CONF:-"${PROJECT_PATH}/gunicorn.conf.py"}
# export LOG_LEVEL=${LOG_LEVEL:-"INFO"}
# export HEALTHCHECK_TIMEOUT=${HEALTHCHECK_TIMEOUT:-"10"}
export GUNICORN_APP=${GUNICORN_APP:-"apip.wsgi"}
# export CELERY_APP=${CELERY_APP:-"apiphantom"}
export GUNICORN_CONF=${GUNICORN_CONF:-"${PROJECT_PATH}/gunicorn.conf.py"}
export LOG_LEVEL=${LOG_LEVEL:-"INFO"}
export HEALTHCHECK_TIMEOUT=${HEALTHCHECK_TIMEOUT:-"10"}

# do_gosu(){
# user="$1"
# shift 1
do_gosu(){
user="$1"
shift 1

# is_exec="false"
# if [ "$1" = "exec" ]; then
# is_exec="true"
# shift 1
# fi
is_exec="false"
if [ "$1" = "exec" ]; then
is_exec="true"
shift 1
fi

# if [ "$(id -u)" = "0" ]; then
# if [ "${is_exec}" = "true" ]; then
# exec gosu "${user}" "$@"
# else
# gosu "${user}" "$@"
# return "$?"
# fi
# else
# if [ "${is_exec}" = "true" ]; then
# exec "$@"
# else
# eval '"$@"'
# return "$?"
# fi
# fi
# }
if [ "$(id -u)" = "0" ]; then
if [ "${is_exec}" = "true" ]; then
exec gosu "${user}" "$@"
else
gosu "${user}" "$@"
return "$?"
fi
else
if [ "${is_exec}" = "true" ]; then
exec "$@"
else
eval '"$@"'
return "$?"
fi
fi
}


# if [[ "start" == "$1" ]]; then
# do_gosu "${PROJECT_USER}:${PROJECT_GROUP}" python manage.py collectstatic --noinput
# do_gosu "${PROJECT_USER}:${PROJECT_GROUP}" exec gunicorn "${GUNICORN_APP}" \
# --name="${APPLICATION_NAME}" \
# --chdir="${PROJECT_PATH}" \
# --bind=0.0.0.0:8000 \
# -c "${GUNICORN_CONF}"
if [[ "start" == "$1" ]]; then
do_gosu "${PROJECT_USER}:${PROJECT_GROUP}" python manage.py collectstatic --noinput
do_gosu "${PROJECT_USER}:${PROJECT_GROUP}" exec gunicorn "${GUNICORN_APP}" \
--name="${APPLICATION_NAME}" \
--chdir="${PROJECT_PATH}" \
--bind=0.0.0.0:8000 \
-c "${GUNICORN_CONF}"

# elif [[ "celery-worker" == "$1" ]]; then
# celery_queue="celery"
Expand Down Expand Up @@ -69,12 +69,4 @@
# exit 0
# fi

# exec "$@"

#!/bin/bash

echo "Running collectstatic"
python manage.py collectstatic --noinput

echo "Starting servers"
gunicorn apip.wsgi -c gunicorn.conf.py
exec "$@"

0 comments on commit 9031f75

Please sign in to comment.