From bd83f65e8be4e7bc2d2a1670d09531bf5923abf3 Mon Sep 17 00:00:00 2001 From: fang19911030 Date: Mon, 16 Oct 2023 18:27:54 -0400 Subject: [PATCH] create workflow file for image build exp --- .github/workflows/dockertest.yaml | 80 +++++++++++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 .github/workflows/dockertest.yaml diff --git a/.github/workflows/dockertest.yaml b/.github/workflows/dockertest.yaml new file mode 100644 index 000000000..324e71956 --- /dev/null +++ b/.github/workflows/dockertest.yaml @@ -0,0 +1,80 @@ +on: + push: + branches: + - update_docker_exp + + +name: Test Docker Image Build Remote + +jobs: + deploy: + name: Docker Test + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + with: + repository: HopkinsIDD/cholera-mapping-pipeline + ref: ${{ github.ref }} + lfs: true + - name: Checkout LFS objects + run: git lfs checkout + - name: Check that lfs files are present + run: wc -l renv.cache/R/renv/cache/v5/R-4.2/x86_64-pc-linux-gnu/abind/1.4-5/4f57884290cc75ab22f4af9e9d4ca862/abind/DESCRIPTION + - + name: Set up QEMU + uses: docker/setup-qemu-action@v1 + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + Username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Generate Tags + id: tags + env: + IMAGE_TAG_RUN: ${{ github.run_number }} + IMAGE_TAG_REF: ${{ github.ref }} + run: | + echo "::set-output name=shashort::$(git log -1 --pretty=%h)" + echo "::set-output name=reftag::${IMAGE_TAG_REF##*/}-r$IMAGE_TAG_RUN" + + - name: Build Push Master + uses: docker/build-push-action@v2 + if: contains( github.ref, 'master') || contains( github.base_ref, 'master' ) + with: + push: false + tags: | + hopkinsidd/choleramappingpipeline:latest + hopkinsidd/choleramappingpipeline:latest-master + hopkinsidd/choleramappingpipeline:${{steps.tags.outputs.shashort}} + hopkinsidd/choleramappingpipeline:${{steps.tags.outputs.reftag}} + hopkinsidd/choleramappingpipeline:${{ github.sha }} + + - name: Build Push Master + uses: docker/build-push-action@v3 + if: (contains( github.ref, 'update_docker') || contains( github.base_ref, 'update_docker' )) + with: + context: . + push: false + tags: | + hopkinsidd/choleramappingpipeline:latest-dev + hopkinsidd/choleramappingpipeline:${{steps.tags.outputs.shashort}} + hopkinsidd/choleramappingpipeline:${{steps.tags.outputs.reftag}} + hopkinsidd/choleramappingpipeline:${{ github.sha }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max + - name: Log Build Information + if: failure() + run: | + du -sh /tmp + du -sh /home/app + - name: Move cache + run: | + rm -rf /tmp/.buildx-cache + rm -rf /tmp/.buildx-cache-new \ No newline at end of file