Skip to content
Snippets Groups Projects
docker-entrypoint.sh 829 B
Newer Older
  • Learn to ignore specific revisions
  • #!/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
    
    Clayton, Brandon Scott's avatar
    Clayton, Brandon Scott committed
      export REQUESTS_CA_BUNDLE="${SSL_CERT_FILE}";
      export PATH="$HOME/.poetry/bin:$PATH";
    
      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}";