From edcdb7604476870e87a55fd420397fa80e8eb990 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Thu, 14 Dec 2023 16:31:35 +0000 Subject: [PATCH] ci: add build-ci img workflow --- .github/workflows/build_ci_img.yml | 36 ++++++++++++++++++++++++++++++ docker/underpass.dockerfile | 6 ++--- 2 files changed, 38 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/build_ci_img.yml diff --git a/.github/workflows/build_ci_img.yml b/.github/workflows/build_ci_img.yml new file mode 100644 index 00000000..7fb47e21 --- /dev/null +++ b/.github/workflows/build_ci_img.yml @@ -0,0 +1,36 @@ +name: 🔧 Build CI Img + +on: + # Push includes PR merge + push: + branches: + - master + paths: + - docker/** + - .github/workflows/** + # Allow manual trigger + workflow_dispatch: + +jobs: + underpass-ci-build: + uses: hotosm/gh-workflows/.github/workflows/image_build.yml@1.4.0 + with: + dockerfile: docker/underpass.dockerfile + scan_dockerfile: false + scan_image: false + build_target: ci + image_tags: | + "ghcr.io/${{ github.repository }}:ci" + + invalidate-cache: + runs-on: ubuntu-latest + steps: + - name: Delete CI Img Cache + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh extension install actions/gh-actions-cache + gh actions-cache delete image-cache-${{ runner.os }} \ + -R ${{ github.repository }} \ + -B ${{ github.ref_name }} \ + --confirm || true diff --git a/docker/underpass.dockerfile b/docker/underpass.dockerfile index af0cef12..0fd1a747 100644 --- a/docker/underpass.dockerfile +++ b/docker/underpass.dockerfile @@ -51,10 +51,8 @@ RUN set -ex \ FROM deps as ci -# Add code only for tests -COPY . . -RUN mv docker/ci-entrypoint.sh /ci-entrypoint.sh \ - && chmod +x /ci-entrypoint.sh +COPY docker/ci-entrypoint.sh /ci-entrypoint.sh +RUN chmod +x /ci-entrypoint.sh ENTRYPOINT [ "/ci-entrypoint.sh" ]