docker_build.sh 770 B

12345678910111213141516171819
  1. #!/bin/bash
  2. DOCKERHUB_USERNAME="lucananni93"
  3. PACKAGE_NAME="calder2"
  4. GITHUB_REPO="CSOgroup/CALDER2"
  5. DOCKER_FILE="docker/Dockerfile"
  6. LATEST_TAG=$(curl --silent "https://api.github.com/repos/${GITHUB_REPO}/releases/latest" | grep '"tag_name"' | cut -d':' -f2 | tr -d '," ')
  7. echo "Building Docker for ${GITHUB_REPO} at ${DOCKERHUB_USERNAME}/${PACKAGE_NAME}:${LATEST_TAG}"
  8. docker build . \
  9. -t ${DOCKERHUB_USERNAME}/${PACKAGE_NAME}:${LATEST_TAG} \
  10. -t ${DOCKERHUB_USERNAME}/${PACKAGE_NAME}:latest \
  11. -f ${DOCKER_FILE} \
  12. --build-arg tag_name=${LATEST_TAG} \
  13. --build-arg repo_name=${GITHUB_REPO}
  14. docker push ${DOCKERHUB_USERNAME}/${PACKAGE_NAME}:${LATEST_TAG}
  15. docker push ${DOCKERHUB_USERNAME}/${PACKAGE_NAME}:latest