buildAndPush.sh 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. # Assume we're in wolfssl/Docker
  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. echo "Building wolfssl/wolfssl-builder:${CUR_DATE} as ${DOCKER_BUILD_OPTIONS}"
  11. docker build -t wolfssl/wolfssl-builder:${CUR_DATE} ${DOCKER_BUILD_OPTIONS} "${WOLFSSL_DIR}/Docker" && \
  12. docker tag wolfssl/wolfssl-builder:${CUR_DATE} wolfssl/wolfssl-builder:latest && \
  13. docker build --build-arg DOCKER_BASE_IMAGE=wolfssl/wolfssl-builder:${CUR_DATE} -t wolfssl/testing-cross-compiler:${CUR_DATE} "${WOLFSSL_DIR}/Docker" -f Dockerfile.cross-compiler && \
  14. docker tag wolfssl/testing-cross-compiler:${CUR_DATE} wolfssl/testing-cross-compiler:latest
  15. if [ $? -eq 0 ]; then
  16. echo "Pushing containers to DockerHub"
  17. docker push wolfssl/wolfssl-builder:${CUR_DATE} && docker push wolfssl/wolfssl-builder:latest && \
  18. docker push wolfssl/testing-cross-compiler:${CUR_DATE} && docker push wolfssl/testing-cross-compiler:latest
  19. else
  20. echo "Warning: Build wolfssl/wolfssl-builder failed. Continuing"
  21. ((NUM_FAILURES++))
  22. fi
  23. echo "Building wolfssl/wolfCLU:${CUR_DATE}"
  24. docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:${CUR_DATE} --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU" && \
  25. docker buildx build --pull --push --build-arg DUMMY=${CUR_DATE} -t wolfssl/wolfclu:latest --platform=linux/amd64,linux/arm64,linux/arm/v7 "${WOLFSSL_DIR}/Docker/wolfCLU"
  26. if [ $? -ne 0 ]; then
  27. echo "Warning: Build wolfssl/wolfclu failed. Continuing"
  28. ((NUM_FAILURES++))
  29. fi
  30. echo "Script completed in $SECONDS seconds. Had $NUM_FAILURES failures."