From 9bb0a2c7bc65b9e8149c31b4aa686ce95b33977c Mon Sep 17 00:00:00 2001 From: John Ballment Date: Wed, 24 Jul 2024 11:29:23 +1000 Subject: [PATCH 1/3] parameterised API Key for Docker builds (#203) (#204) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What type of PR is this? (check all applicable) - [ #203 ] 🍕 Feature - [ ] 🐛 Bug Fix - [ ] 📝 Documentation Update - [ ] 🎨 Style - [ ] 🧑‍💻 Code Refactor - [ ] 🔥 Performance Improvements - [ ] ✅ Test - [ ] 🤖 Build - [ ] 🔁 CI - [ ] 📦 Chore (Release) - [ ] ⏩ Revert ## Description Parameterised API Key for Docker builds ## Related Tickets & Documents #203 and updated README.md ## Mobile & Desktop Screenshots/Recordings N/A ## Added tests? - [ X ] 👍 yes - [ ] 🙅 no, because they aren't needed - [ ] 🙋 no, because I need help ## Added to documentation? - [ X ] 📜 README.md - [ ] 📓 [vc-kit doc site](https://uncefact.github.io/vckit/) - [ ] 📕 storybook - [ ] 🙅 no documentation needed --- README.md | 3 ++- entrypoint.sh | 2 +- local.env | 3 ++- packages/cli/default/agent.template.yml | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 53b39686..a846fadf 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ docker build -t vckit-api . You can customize the Docker image build process by specifying a custom configuration file path for the VCkit API. Ensure that you have the custom configuration file (``) ready. This file should contain the necessary settings and configurations for the VCkit API. -Use the `--build-arg` flag to specify the `DATABASE_TYPE`, `DATABASE_USERNAME`, `DATABASE_PASSWORD`, `DATABASE_NAME`, `DATABASE_HOST`, `DATABASE_PORT`, `DATABASE_ENCRYPTION_KEY`, `PORT`, `PROTOCOL`, and `API_DOMAIN` build arguments when running the docker build command. +Use the `--build-arg` flag to specify the `DATABASE_TYPE`, `DATABASE_USERNAME`, `DATABASE_PASSWORD`, `DATABASE_NAME`, `DATABASE_HOST`, `DATABASE_PORT`, `DATABASE_ENCRYPTION_KEY`, `PORT`, `PROTOCOL`, `API_DOMAIN`, and `API_KEY` build arguments when running the docker build command. ```bash docker build \ @@ -101,6 +101,7 @@ docker build \ --build-arg PORT=3332 \ --build-arg PROTOCOL=http \ --build-arg API_DOMAIN=localhost:3332 \ + --build-arg API_KEY=test123 \ -t vckit-api . ``` diff --git a/entrypoint.sh b/entrypoint.sh index 5120ca9e..ef6bfa02 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -3,7 +3,7 @@ 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 +envsubst '${DATABASE_TYPE},${DATABASE_NAME},${DATABASE_HOST},${DATABASE_PORT},${DATABASE_USERNAME},${DATABASE_PASSWORD},${DATABASE_ENCRYPTION_KEY},${PORT},${PROTOCOL},${API_DOMAIN},${API_KEY}' < /app/agent.template.yml > /app/agent.yml echo "Agent.yml updated." diff --git a/local.env b/local.env index 579060cb..a006065b 100644 --- a/local.env +++ b/local.env @@ -7,4 +7,5 @@ DATABASE_PORT=5432 DATABASE_ENCRYPTION_KEY=29739248cad1bd1a0fc4d9b75cd4d2990de535baf5caadfdf8d8f86664aa830c PORT=3332 PROTOCOL=http -API_DOMAIN=localhost:3332 \ No newline at end of file +API_DOMAIN=localhost:3332 +API_KEY=test1234 \ No newline at end of file diff --git a/packages/cli/default/agent.template.yml b/packages/cli/default/agent.template.yml index ffc89341..33d9a5ee 100644 --- a/packages/cli/default/agent.template.yml +++ b/packages/cli/default/agent.template.yml @@ -214,7 +214,7 @@ server: - - /agent - $require: '@vckit/remote-server?t=function#apiKeyAuth' $args: - - apiKey: test123 + - apiKey: ${API_KEY} - $require: '@vckit/encrypted-storage?t=function#encryptedStoreMiddleware' $args: From 7749c83847b8e34f08acda19ecf8c35e59b78a6f Mon Sep 17 00:00:00 2001 From: John Ballment Date: Wed, 24 Jul 2024 11:30:02 +1000 Subject: [PATCH 2/3] changed Dockerfile to use default agent.template.yml (#201) (#205) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What type of PR is this? (check all applicable) - [ ] 🍕 Feature - [ #201 ] 🐛 Bug Fix - [ ] 📝 Documentation Update - [ ] 🎨 Style - [ ] 🧑‍💻 Code Refactor - [ ] 🔥 Performance Improvements - [ ] ✅ Test - [ ] 🤖 Build - [ ] 🔁 CI - [ ] 📦 Chore (Release) - [ ] ⏩ Revert ## Description Updated Dockerfile to use agent.template.xml from packages/cli/default/ so that running "docker compose up --build" works out of the box. ## Related Tickets & Documents Fixes #201 ## Mobile & Desktop Screenshots/Recordings N/A ## Added tests? - [ X ] 👍 yes - [ ] 🙅 no, because they aren't needed - [ ] 🙋 no, because I need help ## Added to documentation? - [ ] 📜 README.md - [ ] 📓 [vc-kit doc site](https://uncefact.github.io/vckit/) - [ ] 📕 storybook - [ X ] 🙅 no documentation needed ## [optional] Are there any post-deployment tasks we need to perform? Co-authored-by: Nam Hoang --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 253eb2d5..78486802 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ COPY package.json . COPY pnpm-lock.yaml . COPY pnpm-workspace.yaml . COPY lerna.json . -COPY agent.template.yml . +COPY packages/cli/default/agent.template.yml . COPY entrypoint.sh . COPY packages/tsconfig.json packages/ From 3c359dc9f28421dba3d3b26d6fe3bbde5b549c4c Mon Sep 17 00:00:00 2001 From: Kseniya Shychko Date: Tue, 30 Jul 2024 04:05:14 +0200 Subject: [PATCH 3/3] feat(cd): ghcr.io setup and docker image build workflow (#206) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## What type of PR is this? (check all applicable) - [ ] 🍕 Feature - [ ] 🐛 Bug Fix - [ ] 📝 Documentation Update - [ ] 🎨 Style - [ ] 🧑‍💻 Code Refactor - [ ] 🔥 Performance Improvements - [ ] ✅ Test - [ ] 🤖 Build - [x] 🔁 CI - [ ] 📦 Chore (Release) - [ ] ⏩ Revert ## Description ## Related Tickets & Documents ## Mobile & Desktop Screenshots/Recordings ## Added tests? - [ ] 👍 yes - [ ] 🙅 no, because they aren't needed - [ ] 🙋 no, because I need help ## Added to documentation? - [ ] 📜 README.md - [ ] 📓 [vc-kit doc site](https://uncefact.github.io/vckit/) - [ ] 📕 storybook - [ ] 🙅 no documentation needed ## [optional] Are there any post-deployment tasks we need to perform? --- .github/workflows/package.yml | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml index 2df1dcdb..ecef1fab 100644 --- a/.github/workflows/package.yml +++ b/.github/workflows/package.yml @@ -1,16 +1,14 @@ name: package on: -# push: -# branches: -# - next -# - cd_* -# tags: -# - "v[0-9]+.[0-9]+.[0-9]+" -# pull_request: - + push: + tags: + - "v[0-9]+.[0-9]+.[0-9]+" workflow_dispatch: +env: + CI: false + jobs: build: runs-on: ubuntu-latest @@ -18,7 +16,11 @@ jobs: - name: Checkout uses: actions/checkout@v4 - + - name: node_setup + uses: actions/setup-node@v4 + with: + node-version: 20.12.2 + - name: docker meta details id: meta uses: docker/metadata-action@v5 @@ -27,7 +29,7 @@ jobs: flavor: | latest=auto tags: | - type=latest,branch=main + type=edge,branch=next type=semver,pattern={{version}} type=sha @@ -44,10 +46,10 @@ jobs: - name: Push Release uses: docker/build-push-action@v5 with: - push: ${{ startsWith(github.ref, 'refs/tags/') }} + push: ${{ startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/next' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - target: train_package + target: vckit-api # build-args: |