diff --git a/.env b/.env new file mode 100644 index 0000000..b3aaac0 --- /dev/null +++ b/.env @@ -0,0 +1,16 @@ +# Environment Configuration - DEV +NODE_ENV=production + +# API Backend URL +NEXT_PUBLIC_API_URL=https://api.dev.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL +NEXT_PUBLIC_FRONTEND_URL=https://dev.dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://dev.dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=dev-secret-key-change-in-production + +# OAuth Providers +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.env.dev b/.env.dev new file mode 100644 index 0000000..b3aaac0 --- /dev/null +++ b/.env.dev @@ -0,0 +1,16 @@ +# Environment Configuration - DEV +NODE_ENV=production + +# API Backend URL +NEXT_PUBLIC_API_URL=https://api.dev.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL +NEXT_PUBLIC_FRONTEND_URL=https://dev.dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://dev.dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=dev-secret-key-change-in-production + +# OAuth Providers +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..5915a7c --- /dev/null +++ b/.env.example @@ -0,0 +1,26 @@ +# Environment Configuration Example +# Copiez ce fichier en .env.local et remplissez les valeurs + +# Environment +NODE_ENV=development + +# API Backend URL +# Development: http://localhost:4000/api +# Production: https://api.dev.dsp5-archi-o24a-15m-g3.fr/api +NEXT_PUBLIC_API_URL=http://localhost:4000/api + +# Frontend URL +# Development: http://localhost:3000 +# Production: https://dev.dsp5-archi-o24a-15m-g3.fr +NEXT_PUBLIC_FRONTEND_URL=http://localhost:3000 + +# NextAuth Configuration +NEXTAUTH_URL=http://localhost:3000 +NEXTAUTH_SECRET=your-secret-key-change-this + +# OAuth Providers (optionnel) +# Note: Les variables préfixées avec NEXT_PUBLIC_ sont accessibles côté client +NEXT_PUBLIC_GOOGLE_CLIENT_ID= +GOOGLE_CLIENT_SECRET= +NEXT_PUBLIC_FACEBOOK_APP_ID= +FACEBOOK_APP_SECRET= diff --git a/.env.preprod b/.env.preprod new file mode 100644 index 0000000..99c8627 --- /dev/null +++ b/.env.preprod @@ -0,0 +1,16 @@ +# Environment: Preproduction +NODE_ENV=preproduction + +# API Backend URL (Preproduction) +NEXT_PUBLIC_API_URL=https://api.preprod.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL (Preproduction) +NEXT_PUBLIC_FRONTEND_URL=https://preprod.dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://preprod.dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=4+mQhf1k0Ad7hsl35myygwELsw+/vDYsKtj2ovPdFQ0= + +# OAuth Configuration +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.env.production b/.env.production new file mode 100644 index 0000000..b5b45bd --- /dev/null +++ b/.env.production @@ -0,0 +1,16 @@ +# Environment: Production +NODE_ENV=production + +# API Backend URL (Production) +NEXT_PUBLIC_API_URL=https://api.dsp5-archi-o24a-15m-g3.fr/api + +# Frontend URL (Production) +NEXT_PUBLIC_FRONTEND_URL=https://dsp5-archi-o24a-15m-g3.fr + +# NextAuth Configuration +NEXTAUTH_URL=https://dsp5-archi-o24a-15m-g3.fr +NEXTAUTH_SECRET=MkeC4B5MOng3KE3uYipmpiuRv5zLkjpy6fcirJeKG8c= + +# OAuth Configuration +NEXT_PUBLIC_GOOGLE_CLIENT_ID=546665126481-itnlvt22hjn6t0bbgua0aj55h6dpplsk.apps.googleusercontent.com +NEXT_PUBLIC_FACEBOOK_APP_ID=836681122652445 diff --git a/.gitignore b/.gitignore index 5ef6a52..8117710 100644 --- a/.gitignore +++ b/.gitignore @@ -30,8 +30,10 @@ yarn-debug.log* yarn-error.log* .pnpm-debug.log* -# env files (can opt-in for committing if needed) -.env* +# env files +.env.local +.env*.local +.env.local.backup # vercel .vercel diff --git a/Jenkinsfile b/Jenkinsfile index 863ff1d..ac0e9fd 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -111,11 +111,26 @@ pipeline { stage('Build Docker image') { steps { - echo "🐳 Construction de l’image Docker frontend..." - sh """ - docker build -t ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} . - docker tag ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} ${REGISTRY_URL}/${IMAGE_NAME}:latest - """ + echo "🐳 Construction de l'image Docker frontend..." + script { + // Charger les variables d'environnement selon l'environnement + def envFile = ".env.${env.ENV}" + def envVars = sh(script: "cat ${envFile} | grep -E '^NEXT_PUBLIC_' | xargs", returnStdout: true).trim() + + // Construire les arguments de build + def buildArgs = "" + envVars.split().each { envVar -> + def parts = envVar.split('=', 2) + if (parts.size() == 2) { + buildArgs += "--build-arg ${parts[0]}='${parts[1]}' " + } + } + + sh """ + docker build ${buildArgs} -t ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} . + docker tag ${REGISTRY_URL}/${IMAGE_NAME}:${env.TAG} ${REGISTRY_URL}/${IMAGE_NAME}:latest + """ + } } }