-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'next' into renderer2024
* next: chore: fix the dockerfile to set entrypoint chore: update vckit Dockerfile (#184) chore: update DockerFile and agent template (#183) fix: bug fix for dockerize (#174) chore: add cicd for running unit test when creating PR (#180) chore: update agent config file (#181) # Conflicts: # pnpm-lock.yaml
- Loading branch information
Showing
13 changed files
with
188 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Build and Test | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- next | ||
|
||
jobs: | ||
test_and_build: | ||
runs-on: ubuntu-latest | ||
env: | ||
EXCLUDED_PACKAGE_OA_RENDERERS: '!./packages/vckit-oa-renderers/' | ||
EXCLUDED_PACKAGE_CREDENTIAL_OA: '!./packages/credential-oa/' | ||
EXCLUDED_PACKAGE_EXPLORER: '!./packages/demo-explorer/' | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
ref: ${{ github.event.pull_request.head.sha }} | ||
|
||
- name: Install pnpm | ||
run: npm i pnpm --global | ||
|
||
- name: Install Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '21' | ||
|
||
- name: Install dependencies | ||
run: pnpm i --filter ${{ env.EXCLUDED_PACKAGE_OA_RENDERERS }} --filter ${{ env.EXCLUDED_PACKAGE_CREDENTIAL_OA }} --filter ${{ env.EXCLUDED_PACKAGE_EXPLORER }} --no-frozen-lockfile | ||
|
||
- name: Build | ||
run: pnpm build:agent | ||
|
||
- name: Run tests | ||
run: | | ||
pnpm test:packages --changedSince=origin/next --ci --json --coverage --testLocationInResults --outputFile=report.json | ||
- name: Coverage | ||
uses: artiomtr/jest-coverage-report-action@v2 | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
coverage-file: report.json | ||
base-coverage-file: report.json | ||
threshold: 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# Stage 1: Build | ||
FROM node:18 as build | ||
FROM node:20 as build | ||
|
||
WORKDIR /app | ||
|
||
|
@@ -32,20 +32,14 @@ COPY package.json . | |
COPY pnpm-lock.yaml . | ||
COPY pnpm-workspace.yaml . | ||
COPY lerna.json . | ||
COPY packages/cli/default/agent.template.yml ./agent.template.yml | ||
COPY agent.template.yml . | ||
COPY entrypoint.sh . | ||
|
||
COPY packages/tsconfig.json packages/ | ||
COPY packages/tsconfig.settings.json packages/ | ||
|
||
# Install gettext for envsubst command | ||
RUN apt-get update && apt-get install gettext -y | ||
|
||
# Substitute environment variables in agent template file | ||
RUN envsubst '${DATABASE_TYPE},${DATABASE_NAME},${DATABASE_HOST},${DATABASE_PORT},${DATABASE_USERNAME},${DATABASE_PASSWORD},${DATABASE_ENCRYPTION_KEY},${PORT},${PROTOCOL},${API_DOMAIN}' \ | ||
< ./agent.template.yml \ | ||
> ./agent.yml | ||
|
||
# Copy package.json for each package | ||
COPY packages/bitstringStatusList/package.json packages/bitstringStatusList/ | ||
COPY packages/cli/package.json packages/cli/ | ||
COPY packages/core-types/package.json packages/core-types/ | ||
COPY packages/credential-merkle-disclosure-proof/package.json packages/credential-merkle-disclosure-proof/ | ||
|
@@ -57,6 +51,7 @@ COPY packages/oauth-middleware/package.json packages/oauth-middleware/ | |
COPY packages/remote-server/package.json packages/remote-server/ | ||
COPY packages/renderer/package.json packages/renderer/ | ||
COPY packages/revocation-list-2020/package.json packages/revocation-list-2020/ | ||
COPY packages/tools/package.json packages/tools/ | ||
COPY packages/utils/package.json packages/utils/ | ||
COPY packages/vc-api/package.json packages/vc-api/ | ||
|
||
|
@@ -65,6 +60,7 @@ RUN npm install -g [email protected] | |
RUN pnpm install | ||
|
||
# Copy the source code of each package | ||
COPY packages/bitstringStatusList/ packages/bitstringStatusList/ | ||
COPY packages/cli/ packages/cli/ | ||
COPY packages/core-types/ packages/core-types/ | ||
COPY packages/credential-merkle-disclosure-proof/ packages/credential-merkle-disclosure-proof/ | ||
|
@@ -76,23 +72,34 @@ COPY packages/oauth-middleware/ packages/oauth-middleware/ | |
COPY packages/remote-server/ packages/remote-server/ | ||
COPY packages/renderer/ packages/renderer/ | ||
COPY packages/revocation-list-2020/ packages/revocation-list-2020/ | ||
COPY packages/tools/ packages/tools/ | ||
COPY packages/utils/ packages/utils/ | ||
COPY packages/vc-api/ packages/vc-api/ | ||
|
||
# Build the project | ||
RUN pnpm build | ||
|
||
# Stage 2: Run | ||
FROM node:18-alpine as vckit-api | ||
FROM node:20-alpine as vckit-api | ||
|
||
WORKDIR /app | ||
|
||
# Copy the agent config file | ||
COPY --from=build /app/agent.yml ./agent.yml | ||
RUN apk update && apk add | ||
# Update package lists and install gettext and git | ||
RUN apk update && \ | ||
apk add gettext git | ||
|
||
COPY --from=build /app/agent.template.yml ./agent.template.yml | ||
|
||
# Copy built artifacts and node_modules from the build stage | ||
COPY --from=build /app/node_modules ./node_modules | ||
|
||
COPY --from=build /app/.tmp_npm ./.tmp_npm | ||
|
||
COPY --from=build /app/packages/bitstringStatusList/build/ packages/bitstringStatusList/build/ | ||
COPY --from=build /app/packages/bitstringStatusList/node_modules/ packages/bitstringStatusList/node_modules/ | ||
COPY --from=build /app/packages/bitstringStatusList/package.json packages/bitstringStatusList/package.json | ||
|
||
COPY --from=build /app/packages/cli/build/ packages/cli/build/ | ||
COPY --from=build /app/packages/cli/node_modules/ packages/cli/node_modules/ | ||
COPY --from=build /app/packages/cli/package.json packages/cli/package.json | ||
|
@@ -123,6 +130,10 @@ COPY --from=build /app/packages/revocation-list-2020/build/ packages/revocation- | |
COPY --from=build /app/packages/revocation-list-2020/node_modules/ packages/revocation-list-2020/node_modules/ | ||
COPY --from=build /app/packages/revocation-list-2020/package.json packages/revocation-list-2020/package.json | ||
|
||
COPY --from=build /app/packages/tools/build/ packages/tools/build/ | ||
COPY --from=build /app/packages/tools/node_modules/ packages/tools/node_modules/ | ||
COPY --from=build /app/packages/tools/package.json packages/tools/package.json | ||
|
||
COPY --from=build /app/packages/utils/build/ packages/utils/build/ | ||
COPY --from=build /app/packages/utils/node_modules/ packages/utils/node_modules/ | ||
COPY --from=build /app/packages/utils/package.json packages/utils/package.json | ||
|
@@ -132,6 +143,13 @@ COPY --from=build /app/packages/vc-api/node_modules/ packages/vc-api/node_module | |
COPY --from=build /app/packages/vc-api/package.json packages/vc-api/package.json | ||
COPY --from=build /app/packages/vc-api/src/vc-api-schemas/vc-api.yaml packages/vc-api/src/vc-api-schemas/vc-api.yaml | ||
|
||
# Add an entrypoint script to the image | ||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
# Specify the script to run on container start | ||
ENTRYPOINT ["/entrypoint.sh"] | ||
|
||
# Expose the port | ||
EXPOSE ${PORT} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
echo "Updating agent.yml with environment variables..." | ||
|
||
# Replace variables in the agent.yml file with the exported environment variables | ||
envsubst '${DATABASE_TYPE},${DATABASE_NAME},${DATABASE_HOST},${DATABASE_PORT},${DATABASE_USERNAME},${DATABASE_PASSWORD},${DATABASE_ENCRYPTION_KEY},${PORT},${PROTOCOL},${API_DOMAIN}' < /app/agent.template.yml > /app/agent.yml | ||
|
||
echo "Agent.yml updated." | ||
|
||
# Execute the Docker CMD | ||
exec "$@" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,11 +3,13 @@ | |
"version": "1.0.0-beta.5", | ||
"scripts": { | ||
"postinstall": "mkdir .tmp_npm; cd .tmp_npm; mkdir veramo; cd veramo; git init; git remote add -f origin https://github.com/gs-gs/veramo.git; git pull --depth=1 origin vc-v2; pnpm install; pnpm build;", | ||
"build": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-json-modules\" pnpm build:js && pnpm build:api && pnpm build:schema", | ||
"build:js": "pnpm -r --stream build", | ||
"build:api": "pnpm --package=@vckit/cli -c dlx \"pnpm -r --stream extract-api\"", | ||
"build": "pnpm build:agent && pnpm build:explorer", | ||
"build:agent": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-json-modules\" pnpm build:js && pnpm build:api && pnpm build:schema", | ||
"build:js": "pnpm -r --stream --filter !./packages/vckit-oa-renderers/ --filter !./packages/credential-oa/ --filter !./packages/demo-explorer/ build", | ||
"build:api": "pnpm --package=@vckit/cli -c dlx \"pnpm -r --stream --filter !./packages/vckit-oa-renderers/ --filter !./packages/credential-oa/ --filter !./packages/demo-explorer/ extract-api\"", | ||
"build:schema": "pnpm --package=@vckit/cli -c dlx \"pnpm -r --stream generate-plugin-schema\"", | ||
"test": "pnpm test:packages && pnpm test:oa-renderer", | ||
"build:explorer": "pnpm -r --stream --filter=@vckit/demo-explorer build", | ||
"test": "pnpm test:packages", | ||
"test:packages-ci": "pnpm test:packages --coverage=true", | ||
"test:packages": "cross-env NODE_OPTIONS=\"--experimental-vm-modules --experimental-import-meta-resolve\" jest", | ||
"test:packages-watch": "pnpm test:packages --watch --verbose", | ||
|
@@ -84,6 +86,6 @@ | |
"jsonld": "npm:@digitalcredentials/[email protected]" | ||
}, | ||
"engines": { | ||
"node": ">= 18.0.0" | ||
"node": ">= 21.0.0" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.