diff --git a/Dockerfile b/Dockerfile index 5b06cf0..356fe67 100644 --- a/Dockerfile +++ b/Dockerfile @@ -19,4 +19,4 @@ COPY pyproject.toml /app COPY . /app RUN poetry install -CMD ["./start_app.sh"] \ No newline at end of file +CMD ["./start_app_production.sh"] \ No newline at end of file diff --git a/start_app_production.sh b/start_app_production.sh new file mode 100755 index 0000000..a1ad95d --- /dev/null +++ b/start_app_production.sh @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +set -eu + +host=0.0.0.0 +port=8000 + +get_absolute_path() { + cd "$(dirname "$1")" && pwd -P +} + +cd "$(get_absolute_path "$0")" || exit 1 + +[[ "${HOST:-}" ]] && host="${HOST}" +[[ "${PORT:-}" ]] && port="${PORT}" +poetry run alembic upgrade head +poetry run gunicorn ifsguid.main:app -k uvicorn.workers.UvicornWorker --bind "${host}:${port}" --workers 9 \ No newline at end of file