From 3409345e3387a88fd27f865875df183801525bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafael=20C=C3=A1rdenas?= Date: Thu, 13 Feb 2025 10:51:20 -0600 Subject: [PATCH] ci: fix api docker builds, upgrade to node 20, ignore ord from coverage (#426) * ci: fix api docker builds, upgrade to node 20 * try again, ignore ord * fix dockerignore * restore ci order --- .codecov.yml | 2 ++ .dockerignore | 13 ++++--------- .github/workflows/ci.yaml | 9 ++++----- api/ordinals/.dockerignore | 2 -- api/ordinals/.nvmrc | 2 +- .../components/ordinals-api.dockerfile | 7 ++++--- 6 files changed, 15 insertions(+), 20 deletions(-) create mode 100644 .codecov.yml delete mode 100644 api/ordinals/.dockerignore rename api/ordinals/Dockerfile => dockerfiles/components/ordinals-api.dockerfile (70%) diff --git a/.codecov.yml b/.codecov.yml new file mode 100644 index 0000000..190d3d7 --- /dev/null +++ b/.codecov.yml @@ -0,0 +1,2 @@ +ignore: + - "components/ord" diff --git a/.dockerignore b/.dockerignore index 285feb9..0c2c9c4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,9 +1,4 @@ -target/ -examples/ -dockerfiles/ -Dockerfile -.dockerignore -.git* -node_modules -package-lock.json -*.tar.gz +/target/ +/dockerfiles/ +node_modules/ +tmp/ diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 1c685df..bb8da15 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -162,10 +162,9 @@ jobs: cargo tarpaulin --skip-clean --out lcov -- --test-threads=1 - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v4.0.1 + uses: codecov/codecov-action@v4 with: token: ${{ secrets.CODECOV_TOKEN }} - slug: hirosystems/ordhook - name: Print integration environment logs run: cat docker-compose-logs.txt @@ -286,7 +285,7 @@ jobs: uses: docker/metadata-action@v5 with: images: | - hirosystems/${{ matrix.suite }} + hirosystems/${{ matrix.suite }}-api tags: | type=ref,event=branch type=ref,event=pr @@ -302,8 +301,8 @@ jobs: - name: Build/Tag/Push Image uses: docker/build-push-action@v5 with: - context: ./api/${{ matrix.suite }} - file: ./api/${{ matrix.suite }}/Dockerfile + context: . + file: ./dockerfiles/components/${{ matrix.suite }}-api.dockerfile tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} # Only push if (there's a new release on main branch, or if building a non-main branch) and (Only run on non-PR events or only PRs that aren't from forks) diff --git a/api/ordinals/.dockerignore b/api/ordinals/.dockerignore deleted file mode 100644 index 7200802..0000000 --- a/api/ordinals/.dockerignore +++ /dev/null @@ -1,2 +0,0 @@ -**/node_modules -**/tmp diff --git a/api/ordinals/.nvmrc b/api/ordinals/.nvmrc index 3c03207..209e3ef 100644 --- a/api/ordinals/.nvmrc +++ b/api/ordinals/.nvmrc @@ -1 +1 @@ -18 +20 diff --git a/api/ordinals/Dockerfile b/dockerfiles/components/ordinals-api.dockerfile similarity index 70% rename from api/ordinals/Dockerfile rename to dockerfiles/components/ordinals-api.dockerfile index 6d8ae3b..bdccf13 100644 --- a/api/ordinals/Dockerfile +++ b/dockerfiles/components/ordinals-api.dockerfile @@ -1,10 +1,11 @@ -FROM node:18-alpine +FROM node:20-alpine WORKDIR /app -COPY . . +COPY ./api/ordinals /app +COPY .git /.git RUN apk add --no-cache --virtual .build-deps git -RUN npm ci && \ +RUN npm ci --no-audit && \ npm run build && \ npm run generate:git-info && \ npm prune --production