2
0

buildAndPush.sh 1.0 KB

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env bash
  2. # Assume we're in wolfssl/Docker/yocto
  3. WOLFSSL_DIR=$(builtin cd ${BASH_SOURCE%/*}/../..; pwd)
  4. DOCKER_BUILD_OPTIONS="$1"
  5. if [ "${DOCKER_BASE_IMAGE}" != "" ]; then
  6. DOCKER_BUILD_OPTIONS+=" --build-arg DOCKER_BASE_IMAGE=${DOCKER_BASE_IMAGE}"
  7. fi
  8. NUM_FAILURES=0
  9. CUR_DATE=$(date -u +%F)
  10. for ver in kirkstone langdale scarthgap; do
  11. echo "Building wolfssl/yocto:${ver}-${CUR_DATE} as ${DOCKER_BUILD_OPTIONS}"
  12. docker build -t wolfssl/yocto:${ver}-${CUR_DATE} --build-arg YOCTO_VERSION=${ver} --build-arg BUILD_DATE=${CUR_DATE} -f Dockerfile "${WOLFSSL_DIR}/Docker/yocto" && \
  13. docker tag wolfssl/yocto:${ver}-${CUR_DATE} wolfssl/yocto:${ver}-latest
  14. if [ $? -eq 0 ]; then
  15. echo "Pushing containers to DockerHub"
  16. docker push wolfssl/yocto:${ver}-${CUR_DATE} && docker push wolfssl/yocto:${ver}-latest
  17. else
  18. echo "Warning: Build wolfssl/yocto:${ver} failed. Continuing"
  19. ((NUM_FAILURES++))
  20. fi
  21. done
  22. echo "Script completed in $SECONDS seconds. Had $NUM_FAILURES failures."