You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
994 B

  1. #!/usr/bin/env bash
  2. set -o errexit
  3. set -o nounset
  4. # parse arguments
  5. mode="prod"
  6. for opt in "$@"; do
  7. case "${opt}" in
  8. --dev) mode="dev" ;;
  9. esac
  10. done
  11. set -eo pipefail
  12. # install build dependencies
  13. apt-get update
  14. apt-get install --no-install-recommends -y --allow-downgrades \
  15. curl \
  16. gnupg=2.1.18-8~deb9u4 \
  17. apt-transport-https
  18. # install dependency to compile django-pyodbc-azure
  19. if [[ "${mode}" = "dev" ]]; then
  20. apt-get install --no-install-recommends -y \
  21. unixodbc-dev=2.3.4-1
  22. fi
  23. # add mssql repo
  24. curl -fsS https://packages.microsoft.com/keys/microsoft.asc | apt-key add -
  25. curl -fsS https://packages.microsoft.com/config/debian/9/prod.list > /etc/apt/sources.list.d/mssql.list
  26. apt-get update
  27. # install mssql
  28. ACCEPT_EULA=Y apt-get install --no-install-recommends -y \
  29. msodbcsql17=17.3.1.1-1 \
  30. mssql-tools=17.3.0.1-1
  31. # remove build dependencies and artifacts
  32. apt-get remove -y \
  33. curl gnupg apt-transport-https
  34. rm -rf /var/lib/apt/lists/*