diff --git a/docker-entrypoint.sh b/docker-entrypoint.sh new file mode 100644 index 0000000000000000000000000000000000000000..2f3d8b3e97bdb99103c42042bff9b380de86c7ea --- /dev/null +++ b/docker-entrypoint.sh @@ -0,0 +1,30 @@ +#!/bin/bash + +INSTALL_DATABASE="${INSTALL_DATABASE:-false}"; +NETCDF_FILE="${NETCDF_FILE:-"/app/data.nc"}"; +NSHM="${NSHM:-"CONUS_2018A"}"; +PROJECT="${PROJECT:-nshmp-netcdf}"; + +# TODO: Remove option to install database in container when deployed to AWS +if [ "${INSTALL_DATABASE}" == "true" ]; then + source "{$HOME}"/.poetry/env; + poetry install; + + case "${NSHM}" in + "CONUS_2018A") + poetry run netcdf \ + --2018A \ + --clean-ascii \ + --database-directory="/app/DATA" \ + --netcdf-filename="${NETCDF_FILE}"; + ;; + *) + printf "ERROR: NSHM %s not supported" "${NSHM}"; + ;; + esac +fi + +/usr/bin/java -jar "${PROJECT}.jar" \ + "-Dmicronaut.server.context-path=${CONTEXT_PATH}" \ + -nshm="${NSHM}" \ + -netcdf="${NETCDF_FILE}";