From 8999ecdafd11c218fd6ab126e224dfcd74f97f56 Mon Sep 17 00:00:00 2001 From: Abdhesh Nayak Date: Thu, 21 Dec 2023 09:42:26 +0530 Subject: [PATCH 1/3] :bug: Fixed issue with redirects while not logged in. --- lib/server/helpers/minimal-auth.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/server/helpers/minimal-auth.ts b/lib/server/helpers/minimal-auth.ts index b234076b0..5bcd8aaeb 100644 --- a/lib/server/helpers/minimal-auth.ts +++ b/lib/server/helpers/minimal-auth.ts @@ -24,7 +24,10 @@ export const minimalAuth = async (ctx: IExtRemixCtx) => { headers: ctx.request?.headers, }).whoAmI(); - if (whoAmI.errors && whoAmI.errors[0].message === 'user not logged in') { + if ( + whoAmI.errors && + whoAmI.errors[0].message === 'input: auth_me user not logged in' + ) { return redirect(`${authBaseUrl}/login`); } From e3bcf034748f7fe2771381870089b0d2f6995baa Mon Sep 17 00:00:00 2001 From: Bikash Date: Thu, 21 Dec 2023 11:50:54 +0530 Subject: [PATCH 2/3] Added dockerfile for website, modified taskfile --- .dockerignore | 2 ++ Dockerfile.website | 17 +++++++++++++++++ Taskfile.yaml | 11 ++++++++++- src/design-system/package.json | 2 +- 4 files changed, 30 insertions(+), 2 deletions(-) create mode 100644 Dockerfile.website diff --git a/.dockerignore b/.dockerignore index 6054ff4c2..c5935792a 100644 --- a/.dockerignore +++ b/.dockerignore @@ -18,3 +18,5 @@ src/generated/node_modules src/generated/plugin/node_modules src/design-system/node_modules +src/apps/devdoc/node_modules +src/apps/devdoc/.next diff --git a/Dockerfile.website b/Dockerfile.website new file mode 100644 index 000000000..5f67f8eec --- /dev/null +++ b/Dockerfile.website @@ -0,0 +1,17 @@ +FROM node:20.8.1-alpine as node +WORKDIR /app + +COPY ./src/apps/devdoc ./src/apps/devdoc +COPY ./src/design-system/tailwind-base.js ./src/design-system/tailwind-base.js +COPY ./src/design-system/css-plugins ./src/design-system/css-plugins +COPY ./src/design-system/css ./src/design-system/css +COPY ./src/design-system/out ./src/design-system/out + +WORKDIR /app/src/apps/devdoc + +RUN npm i -g pnpm +RUN pnpm i -p + +RUN npm run build + +ENTRYPOINT pnpm start \ No newline at end of file diff --git a/Taskfile.yaml b/Taskfile.yaml index b0fb795b8..e3971bb22 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -35,7 +35,7 @@ tasks: case $(whoami) in "bikash") - URL_SUFFIX=1 + URL_SUFFIX="" ;; "vision") @@ -170,3 +170,12 @@ tasks: - docker push {{.IMAGE}}/auth:{{.tag}} - docker build --build-arg APP=console . -t {{.IMAGE}}/console:{{.tag}} - docker push {{.IMAGE}}/console:{{.tag}} + + docker-build-website: + preconditions: + - sh: '[[ -n "{{.tag}}" ]]' + msg: "var tag must have a value" + silent: false + cmds: + - cd ./src/design-system && mkdir -p out && pnpm local:release + - docker buildx build --platform linux/amd64 . -t {{.tag}} -f Dockerfile.website diff --git a/src/design-system/package.json b/src/design-system/package.json index 54a692234..7906afb65 100644 --- a/src/design-system/package.json +++ b/src/design-system/package.json @@ -8,7 +8,7 @@ "author": "", "license": "ISC", "scripts": { - "local:release": "npm run build:css && npm run build && node prod-package.js && cd dist && npm pack --pack-destination ../out", + "local:release": "mkdir -p out && npm run build:css && npm run build && node prod-package.js && cd dist && npm pack --pack-destination ../out", "build": "npm run clean && node build.js && npm run tsc", "clean": "rimraf dist", "tsc": "tsc --emitDeclarationOnly --outDir ./dist/", From 7a4df4410d2c5a03f4631c78f4d406402174a0a6 Mon Sep 17 00:00:00 2001 From: Bikash Date: Thu, 21 Dec 2023 12:16:07 +0530 Subject: [PATCH 3/3] Added ci workflow for website --- .github/workflows/build-container.yaml | 12 ++++++++++-- Taskfile.yaml | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-container.yaml index cdeeb43f3..093041dda 100644 --- a/.github/workflows/build-container.yaml +++ b/.github/workflows/build-container.yaml @@ -21,6 +21,14 @@ jobs: app: - auth - console + - website + include: + - app: auth + dockerFile: Dockerfile + - app: console + dockerFile: Dockerfile + - app: website + dockerFile: Dockerfile.website runs-on: ubuntu-latest name: Deploy to Docker Image steps: @@ -47,5 +55,5 @@ jobs: branch_name=${GITHUB_REF#refs/heads/} version_string="v${branch_name#release-}-nightly" - docker build --build-arg APP=${{matrix.app}} . -t ghcr.io/kloudlite/platform/web/${{matrix.app}}:$version_string --push - docker build --build-arg APP=${{matrix.app}} . -t ghcr.io/kloudlite/platform/web/${{matrix.app}}:commit-${GITHUB_SHA} --push \ No newline at end of file + docker build --build-arg APP=${{matrix.app}} -f ${{matrix.dockerFile}} . -t ghcr.io/kloudlite/platform/web/${{matrix.app}}:$version_string --push + docker build --build-arg APP=${{matrix.app}} -f ${{matrix.dockerFile}} . -t ghcr.io/kloudlite/platform/web/${{matrix.app}}:commit-${GITHUB_SHA} --push \ No newline at end of file diff --git a/Taskfile.yaml b/Taskfile.yaml index e3971bb22..ba62b354c 100644 --- a/Taskfile.yaml +++ b/Taskfile.yaml @@ -177,5 +177,5 @@ tasks: msg: "var tag must have a value" silent: false cmds: - - cd ./src/design-system && mkdir -p out && pnpm local:release - - docker buildx build --platform linux/amd64 . -t {{.tag}} -f Dockerfile.website + # - cd ./src/design-system && mkdir -p out && pnpm local:release + - docker buildx build . -t {{.tag}} -f Dockerfile.website