Skip to content

Commit

Permalink
fix(cli): Install server package in the cli container to inlcude lerc. (
Browse files Browse the repository at this point in the history
#3353)

### Motivation

The [cli
container](https://github.com/linz/basemaps-config/actions/runs/11096451992/job/30827033370?pr=984)
requires lerc to be installed which come from server.

`
node:internal/modules/cjs/loader:1228
  throw err;
  ^

Error: Cannot find module 'lerc'
Require stack:
- /app/index.cjs
at Module._resolveFilename (node:internal/modules/cjs/loader:1225:15)
    at Module._load (node:internal/modules/cjs/loader:1051:27)
    at Module.require (node:internal/modules/cjs/loader:1311:19)
    at require (node:internal/modules/helpers:179:18)
    at Object.<anonymous> (/app/index.cjs:190419:27)
    at Module._compile (node:internal/modules/cjs/loader:1469:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
    at Module.load (node:internal/modules/cjs/loader:1288:32)
    at Module._load (node:internal/modules/cjs/loader:1104:12)
at Function.executeUserEntryPoint [as runMain]
(node:internal/modules/run_main:[174](https://github.com/linz/basemaps-config/actions/runs/11096451992/job/30827033370?pr=984#step:6:175):12)
{
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/app/index.cjs' ]
}
`

### Modifications
Install serve package in the cli container.

### Verification
Container fixed after install server package, add smoke test in the
container ci/cd for validation
  • Loading branch information
Wentao-Kuang authored Sep 30, 2024
1 parent 99c1a75 commit 9b2b785
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
28 changes: 27 additions & 1 deletion .github/workflows/containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,19 @@ jobs:
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: '@basemaps/cli - Build and export to Docker'
uses: docker/build-push-action@v5
with:
context: packages/cli
load: true
tags: |
ghcr.io/linz/basemaps/cli:latest
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }}
- name: '@basemaps/cli - Test'
run: |
docker run --rm ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }} --help
- name: '@basemaps/cli - Build and push'
uses: docker/build-push-action@v5
with:
Expand All @@ -77,9 +90,21 @@ jobs:
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version_major }}
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version_major_minor }}
ghcr.io/linz/basemaps/cli:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')}}

- name: '@basemaps/server - Build and export to Docker'
uses: docker/build-push-action@v5
with:
context: packages/server
load: true
tags: |
ghcr.io/linz/basemaps/server:latest
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
- name: '@basemaps/server - Test'
run: |
docker run --rm ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }} --version
- name: '@basemaps/server - Build and push'
uses: docker/build-push-action@v5
with:
Expand All @@ -102,3 +127,4 @@ jobs:
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version_major_minor }}
ghcr.io/linz/basemaps/server:${{ steps.version.outputs.version }}
push: ${{github.ref == 'refs/heads/master' && startsWith(github.event.head_commit.message, 'release:')}}

3 changes: 2 additions & 1 deletion packages/cli/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,12 @@ RUN npm install sharp@0.33.0
COPY ./basemaps-landing*.tgz /app/
COPY ./basemaps-cogify*.tgz /app/
COPY ./basemaps-smoke*.tgz /app/
COPY ./basemaps-server*.tgz /app/

# Copy the static files for v1/health check
COPY ./static/ /app/static/

RUN npm install ./basemaps-landing*.tgz ./basemaps-cogify*.tgz ./basemaps-smoke*.tgz
RUN npm install ./basemaps-landing*.tgz ./basemaps-cogify*.tgz ./basemaps-smoke*.tgz ./basemaps-server*.tgz

COPY dist/index.cjs /app/

Expand Down

0 comments on commit 9b2b785

Please sign in to comment.