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.

45 lines
959 B

  1. #!/bin/bash
  2. # ACMED certificate watcher and renewer daemon.
  3. # Helper script to build debian based docker image
  4. # Author: Nicolas Karageuzian
  5. set -euo pipefail
  6. DIR="$( cd "$( dirname "$0" )/../.." >/dev/null 2>&1 && pwd )"
  7. # Parse command line args
  8. if [ "$#" -ne 1 ]; then
  9. echo "Usage: $0 <target>"
  10. echo "Supported targets: stretch, buster"
  11. exit 1
  12. fi
  13. if [ "$1" == "buster" ]; then
  14. TARGET=buster
  15. elif [ "$1" == "stretch" ]; then
  16. TARGET=stretch
  17. else
  18. echo "Invalid target: $1"
  19. exit 1
  20. fi
  21. # Determine image
  22. IMAGE=rust:1-$TARGET
  23. function log {
  24. echo -e "\033[32;1m==> ${1}\033[0m"
  25. }
  26. # This or commit Dockerfile at project root
  27. log "Prepare docker build"
  28. cp $( dirname "$0" )/Dockerfile $DIR
  29. cd $DIR
  30. log "Build docker image"
  31. docker build -t acmed:$TARGET --build-arg TARGET=$TARGET .
  32. log "Successfully built image, Cleanup"
  33. rm Dockerfile
  34. log "Done! Find your binaries in the /usr/local/bin directory of image acmed:$TARGET."