-
Notifications
You must be signed in to change notification settings - Fork 97
chore: add card-service and pos-service image build steps in CI #3657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
oana-lolea
wants to merge
20
commits into
pos-card-services
Choose a base branch
from
oana/raf-1167
base: pos-card-services
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
20 commits
Select commit
Hold shift + click to select a range
20cad32
Added card-service and point-of-sale images when pushing to registry
oana-lolea ad454d1
Added dockerfile.prod for card-service
oana-lolea 8f234f4
Added spectral to validate card-service open api specs
oana-lolea 2d2455c
Fix on building the packages
oana-lolea 3e32309
Fixed dockerfile
oana-lolea 96ac9e6
Added token-introspection
oana-lolea a07b242
trying to fix crypto issue
oana-lolea 130fa28
Another try to fix card-service pipeline
oana-lolea 47573c8
Still trying
oana-lolea be2db81
Testing if crypto is actually the issue here
oana-lolea 968c491
Trying to debug
oana-lolea 67a84bb
Added @types/node so it can see the crypto package
oana-lolea 59d6258
Updated yaml for card-service, removed unnecessary changes
oana-lolea 6a654cf
Fix format
oana-lolea 0a4860c
Updated axios version of pos
oana-lolea 391c62a
Merge branch 'pos-card-services' into oana/raf-1167
oana-lolea 501f9ef
Added tags to card-service.yaml
oana-lolea eaf4a0b
Removed token-introspection from pos and card services
oana-lolea e4d68ce
Added command to run pos and card services in docker file
oana-lolea 71eec80
Merge branch 'pos-card-services' into oana/raf-1167
oana-lolea File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,65 @@ | ||
FROM node:20-alpine3.20 AS base | ||
|
||
WORKDIR /home/rafiki | ||
|
||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
|
||
RUN corepack enable | ||
RUN corepack prepare [email protected] --activate | ||
|
||
COPY pnpm-lock.yaml ./ | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ | ||
pnpm fetch \ | ||
| grep -v "cross-device link not permitted\|Falling back to copying packages from store" | ||
|
||
FROM base AS prod-deps | ||
|
||
COPY package.json pnpm-workspace.yaml .npmrc ./ | ||
COPY packages/card-service/knexfile.js ./packages/card-service/knexfile.js | ||
COPY packages/card-service/package.json ./packages/card-service/package.json | ||
RUN pnpm clean | ||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ | ||
pnpm install \ | ||
--recursive \ | ||
--prefer-offline \ | ||
--frozen-lockfile \ | ||
--prod \ | ||
| grep -v "cross-device link not permitted\|Falling back to copying packages from store" | ||
|
||
FROM base AS builder | ||
|
||
COPY package.json pnpm-workspace.yaml .npmrc tsconfig.json tsconfig.build.json ./ | ||
COPY packages/card-service ./packages/card-service | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store \ | ||
pnpm install \ | ||
--recursive \ | ||
--offline \ | ||
--frozen-lockfile | ||
RUN pnpm --filter card-service build | ||
|
||
FROM node:20-alpine3.20 AS runner | ||
|
||
# Since this is from a fresh image, we need to first create the Rafiki user | ||
RUN adduser -D rafiki | ||
WORKDIR /home/rafiki | ||
|
||
COPY --from=prod-deps /home/rafiki/node_modules ./node_modules | ||
COPY --from=prod-deps /home/rafiki/packages/card-service/node_modules ./packages/card-service/node_modules | ||
COPY --from=prod-deps /home/rafiki/packages/card-service/package.json ./packages/card-service/package.json | ||
COPY --from=prod-deps /home/rafiki/packages/card-service/knexfile.js ./packages/card-service/knexfile.js | ||
|
||
COPY --from=builder /home/rafiki/packages/card-service/migrations/ ./packages/card-service/migrations | ||
COPY --from=builder /home/rafiki/packages/card-service/dist ./packages/card-service/dist | ||
COPY --from=builder /home/rafiki/packages/card-service/knexfile.js ./packages/card-service/knexfile.js | ||
|
||
USER root | ||
|
||
# For additional paranoia, we make it so that the Rafiki user has no write access to the packages | ||
RUN chown -R :rafiki /home/rafiki/packages | ||
RUN chmod -R 750 /home/rafiki/packages | ||
|
||
USER rafiki | ||
CMD ["node", "/home/rafiki/packages/card-service/dist/index.js"] |
This file contains hidden or 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,10 +1,6 @@ | ||
{ | ||
"name": "card-service", | ||
"main": "dist/index.js", | ||
"types": "dist/index.d.ts", | ||
"files": [ | ||
"dist/**/*" | ||
], | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "pnpm clean && tsc --build tsconfig.json", | ||
"clean": "rm -fr dist/", | ||
|
@@ -37,6 +33,7 @@ | |
"@types/koa-bodyparser": "^4.3.12", | ||
"@types/koa__cors": "^5.0.0", | ||
"@types/koa__router": "^12.0.4", | ||
"@types/node": "^20.14.15", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Needed this so that the pipeline can recognise |
||
"@types/uuid": "^9.0.8", | ||
"jest-environment-node": "^29.7.0", | ||
"nock": "14.0.0-beta.19", | ||
|
This file contains hidden or 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,7 +1,13 @@ | ||
openapi: 3.0.3 | ||
info: | ||
title: Card Service API | ||
version: 1.0.0 | ||
description: Card Service API specs | ||
contact: | ||
email: [email protected] | ||
tags: | ||
- name: payment | ||
description: Operations related to payments | ||
paths: | ||
/payment: | ||
post: | ||
|
@@ -67,6 +73,9 @@ | |
description: Card expired or invalid signature | ||
'500': | ||
description: Internal server error | ||
description: 'POS service calls this endpoint to initiate a payment request.' | ||
tags: | ||
- payment | ||
/payment-event: | ||
post: | ||
summary: Handle payment event result from backend | ||
|
@@ -106,3 +115,6 @@ | |
description: Malformed request body | ||
'404': | ||
description: Request not found | ||
description: 'Rafiki backend calls this endpoint to send the payment result.' | ||
tags: | ||
- payment |
This file contains hidden or 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 hidden or 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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we are missing a
CMD
here to run the app, same thing for thepos-service
one