diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 00000000..40b878db
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+node_modules/
\ No newline at end of file
diff --git a/.github/workflows/web.yaml b/.github/workflows/web.yaml
new file mode 100644
index 00000000..ba9412f8
--- /dev/null
+++ b/.github/workflows/web.yaml
@@ -0,0 +1,69 @@
+on:
+ push:
+ paths: ['apps/web/**', '.github/workflows/web.yaml']
+ pull_request:
+ paths: ['apps/web/**']
+
+jobs:
+ validate:
+ runs-on: ubuntu-latest
+ name: Validate
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Install Node.js
+ uses: actions/setup-node@v3
+ with:
+ node-version: 20
+
+ - name: Install pnpm
+ uses: pnpm/action-setup@v2
+ with:
+ version: 8
+ run_install: false
+
+ - name: Install packages
+ run: |
+ pnpm i
+
+ - name: Lint
+ run: |
+ pnpm run lint:web
+
+ - name: Test
+ run: |
+ pnpm run test:web
+
+ build:
+ needs: validate
+ if: github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ name: Build and push docker image
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+
+ - name: Login to Docker Hub
+ uses: docker/login-action@v1
+ with:
+ username: ${{ secrets.DOCKER_USERNAME }}
+ password: ${{ secrets.DOCKER_PASSWORD }}
+
+ - name: Build Docker image
+ run: docker build -t keyshade/keyshade-web:latest -f Dockerfile-web .
+
+ - name: Push Docker image
+ run: docker push keyshade/keyshade-web
+
+ deploy:
+ needs: build
+ if: github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ name: Deploy to Render
+
+ steps:
+ - name: deploy
+ run: curl ${{ secrets.RENDER_WEB_DEPLOY_HOOK }}
diff --git a/Dockerfile-web b/Dockerfile-web
new file mode 100644
index 00000000..be12b92e
--- /dev/null
+++ b/Dockerfile-web
@@ -0,0 +1,18 @@
+FROM node:20-alpine as build
+
+WORKDIR /app
+
+RUN npm i -g pnpm
+
+COPY package.json .
+COPY tsconfig.base.json .
+
+RUN pnpm install
+
+COPY apps/web apps/web
+
+RUN pnpm run build:web
+
+EXPOSE 3000
+
+ENTRYPOINT ["pnpm", "run", "start:web"]
\ No newline at end of file
diff --git a/apps/web/.gitignore b/apps/web/.gitignore
new file mode 100644
index 00000000..e985853e
--- /dev/null
+++ b/apps/web/.gitignore
@@ -0,0 +1 @@
+.vercel
diff --git a/apps/web/app/page.tsx b/apps/web/app/page.tsx
index 2a6c9093..6d7df09c 100644
--- a/apps/web/app/page.tsx
+++ b/apps/web/app/page.tsx
@@ -1,13 +1,13 @@
-
import { Poppins } from 'next/font/google'
-import Links from './components/Links'
-import Killers from './components/Killers'
+import Links from '../components/Links'
+import Killers from '../components/Killers'
import { Logo, Grid, Stars } from '../public'
const poppins = Poppins({
subsets: ['latin'],
weight: ['400', '500', '600', '700']
})
-export default async function Index() {
+
+function Index() {
return (
@@ -15,7 +15,7 @@ export default async function Index() {
-
+
@@ -35,13 +35,21 @@ export default async function Index() {
-
-
+
+
-
-
+
+
@@ -49,3 +57,5 @@ export default async function Index() {
)
}
+
+export default Index
diff --git a/apps/web/app/components/Killers.tsx b/apps/web/components/Killers.tsx
similarity index 100%
rename from apps/web/app/components/Killers.tsx
rename to apps/web/components/Killers.tsx
diff --git a/apps/web/app/components/Links.tsx b/apps/web/components/Links.tsx
similarity index 100%
rename from apps/web/app/components/Links.tsx
rename to apps/web/components/Links.tsx
diff --git a/apps/web/next.config.js b/apps/web/next.config.js
index d7197c59..17994a2e 100644
--- a/apps/web/next.config.js
+++ b/apps/web/next.config.js
@@ -1,10 +1,10 @@
-//@ts-check
+const { composePlugins, withNx } = require('@nx/next')
-// eslint-disable-next-line @typescript-eslint/no-var-requires
-const path = require('path')
-
-/** @type {import('next').NextConfig} */
+/**
+ * @type {import('@nx/next/plugins/with-nx').WithNxOptions}
+ **/
const nextConfig = {
+ distDir: 'dist/.next',
webpack(config, { isServer }) {
config.module.rules.push({
test: /\.svg$/,
@@ -12,11 +12,22 @@ const nextConfig = {
})
if (!isServer) {
- config.resolve.alias['@public'] = path.join(__dirname, 'public')
+ // eslint-disable-next-line no-undef
+ // config.resolve.alias['@public'] = path.join(__dirname, 'public')
}
return config
+ },
+ nx: {
+ // Set this to true if you would like to use SVGR
+ // See: https://github.com/gregberge/svgr
+ svgr: false
}
}
-module.exports = nextConfig
+const plugins = [
+ // Add more Next.js plugins to this list if needed.
+ withNx
+]
+
+module.exports = composePlugins(...plugins)(nextConfig)
diff --git a/apps/web/project.json b/apps/web/project.json
index beb8805b..3bf07d7e 100644
--- a/apps/web/project.json
+++ b/apps/web/project.json
@@ -9,18 +9,12 @@
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
- "outputPath": "dist/apps/web"
- },
- "configurations": {
- "development": {
- "outputPath": "apps/web"
- },
- "production": {}
+ "outputPath": "apps/web/dist"
}
},
"serve": {
"executor": "@nx/next:server",
- "defaultConfiguration": "development",
+ "defaultConfiguration": "production",
"options": {
"buildTarget": "web:build",
"dev": true,
diff --git a/apps/web/tsconfig.json b/apps/web/tsconfig.json
index 7eec5b7f..b047d0cd 100644
--- a/apps/web/tsconfig.json
+++ b/apps/web/tsconfig.json
@@ -29,7 +29,9 @@
"../../apps/web/.next/types/**/*.ts",
"../../dist/apps/web/.next/types/**/*.ts",
"next-env.d.ts",
- ".next/types/**/*.ts"
+ ".next/types/**/*.ts",
+ "../../apps/web/dist/.next/types/**/*.ts",
+ "dist/.next/types/**/*.ts"
],
"exclude": [
"node_modules",
diff --git a/apps/web/vercel.json b/apps/web/vercel.json
new file mode 100644
index 00000000..a409995b
--- /dev/null
+++ b/apps/web/vercel.json
@@ -0,0 +1,5 @@
+{
+ "installCommand": "pnpm install",
+ "buildCommand": "pnpm run build:web",
+ "framework": "nextjs"
+}
diff --git a/package.json b/package.json
index cf456083..cba99b3d 100644
--- a/package.json
+++ b/package.json
@@ -28,6 +28,7 @@
"test:workspace": "nx run workspace:test",
"test:cli": "nx run cli:test",
"test:sdk-node": "nx run sdk-js:test",
+ "start:web": "nx run web:serve",
"db:seed": "cd apps/api/src/prisma && pnpx ts-node seed.ts",
"db:generate-types": "nx run api:prisma:generate",
"db:generate-migrations": "cd apps/api/src/prisma && pnpx prisma migrate dev --create-only --skip-seed",