Compare commits

...

3 Commits

Author SHA1 Message Date
andrzej 4716264483 configure for subdomain
Gitea/subman-nextjs/pipeline/head This commit looks good Details
2024-10-04 11:15:30 +02:00
andrzej 5fb913b6a3 local build works (including static) 2024-10-04 11:15:10 +02:00
andrzej 19109b2b35 set up local build environment for packaging 2024-10-04 10:36:00 +02:00
5 changed files with 16 additions and 10 deletions

4
.gitignore vendored
View File

@ -38,3 +38,7 @@ next-env.d.ts
#secret #secret
.env .env
#build
/pack
subman.tar.gz

7
Jenkinsfile vendored
View File

@ -9,13 +9,6 @@ agent any
steps{ steps{
sh 'npm install' sh 'npm install'
sh 'npm run build' sh 'npm run build'
sh 'mkdir standalone'
sh 'cp -r public standalone/'
sh 'cp -r prisma standalone/'
sh 'cp -r .next/static standalone/.next/'
sh 'cp -r .next/standalone/** standalone/'
sh ' tar -cf subman.tar.gz standalone '
sh 'rm -r standalone'
} }
} }
stage('deploy'){ stage('deploy'){

View File

@ -5,7 +5,7 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build && ./package.sh",
"start": "next start", "start": "next start",
"lint": "next lint", "lint": "next lint",
"tailwind": "npx tailwindcss -i ./src/app/globals.css -o ./src/app/tailwind.css --watch" "tailwind": "npx tailwindcss -i ./src/app/globals.css -o ./src/app/tailwind.css --watch"

9
package.sh Executable file
View File

@ -0,0 +1,9 @@
#!/usr/bin/env bash
mkdir pack
cp -r public pack/
cp -r prisma pack/
cp -r .next/standalone/. pack/
cp -r .next/static pack/.next/
tar -cf subman.tar.gz pack
rm -r pack

View File

@ -17,7 +17,7 @@ export default async function(request: NextRequest): Promise<NextResponse> | und
const url = request.nextUrl.clone() const url = request.nextUrl.clone()
url.pathname = "subman/login" url.pathname = "/login"
url.searchParams.set('from', request.nextUrl.pathname) url.searchParams.set('from', request.nextUrl.pathname)
if (protectedRoutes.some(pattern => matchesWildcard(request.nextUrl.pathname, pattern))) { if (protectedRoutes.some(pattern => matchesWildcard(request.nextUrl.pathname, pattern))) {
const token = request.cookies.get('token') const token = request.cookies.get('token')
@ -47,7 +47,7 @@ export default async function(request: NextRequest): Promise<NextResponse> | und
//TODO - TEST THIS BECAUSE IT PROBABLY DOESN'T WORK //TODO - TEST THIS BECAUSE IT PROBABLY DOESN'T WORK
//redirect from login if already logged in //redirect from login if already logged in
let redirectToApp = false let redirectToApp = false
if (request.nextUrl.pathname === "subman/login") { if (request.nextUrl.pathname === "/login") {
const token = request.cookies.get("token") const token = request.cookies.get("token")
if (token) { if (token) {
try { try {