diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..069870e --- /dev/null +++ b/Dockerfile @@ -0,0 +1,24 @@ + +# Base image +FROM node:18-alpine + +# Set working directory +WORKDIR /app + +# Install dependencies +COPY package*.json ./ +RUN yarn install +#RUN npm install + +# Copy project files +COPY . . + + +RUN yarn build + +# Expose port +EXPOSE 3000 +CMD ["yarn", "start"] + +# Start the application in development mode +#CMD ["npm", "run", "dev"] diff --git a/Jenkinsfile b/Jenkinsfile new file mode 100644 index 0000000..f8f7adb --- /dev/null +++ b/Jenkinsfile @@ -0,0 +1,27 @@ +pipeline { + environment { + develop_server_ip = '' + develop_server_name = '' + production_server_ip = "88.99.212.243" + production_server_name = "newhorizon_germany_001_server" + project_path = "/projects/aqila/aqila_frontend/" + version = "main" + gitBranch = "origin/main" + } + agent any + stages { + stage('deploy'){ + steps{ + script{ + if(gitBranch=="origin/main"){ + withCredentials([usernamePassword(credentialsId: production_server_name, usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { + sh 'sshpass -p $PASSWORD ssh $USERNAME@$production_server_ip -o StrictHostKeyChecking=no "cd $project_path && ./runner.sh"' + sh "curl -F chat_id=-1002316394394 -F message_thread_id=11 -F document=@/var/jenkins_home/jobs/${env.JOB_NAME}/builds/${env.BUILD_NUMBER}/log -F caption='Project name: #${env.JOB_NAME} \nBuild status is ${currentBuild.currentResult} \nBuild url: ${BUILD_URL}' https://api.telegram.org/bot7207581748:AAFeymryw7S44D86LYfWqYK-tSNeV3TOwBs/sendDocument" + } + } + } + } + } + } +} + diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..dac1fc4 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,16 @@ +version: "3.7" +services: + web: + # container_name: aqila_react + ports: + - 9015:3000 + build: + context: . + dockerfile: Dockerfile + restart: always + networks: + - aqila_backend_aqila + +networks: + aqila_backend_aqila: + external: true diff --git a/next.config.js b/next.config.js index e493b2f..506c17c 100644 --- a/next.config.js +++ b/next.config.js @@ -1,5 +1,5 @@ /** @type {import('next').NextConfig} */ -const nextConfig = { +const nextConfig = { reactStrictMode: false, images: { remotePatterns: [ @@ -35,6 +35,15 @@ const nextConfig = { }, ], }, + typescript: { + ignoreBuildErrors: true, + }, + eslint: { + ignoreDuringBuilds: true, + }, + trailingSlash: true, }; module.exports = nextConfig; + + diff --git a/package.json b/package.json index c76d8ab..c9bc2ff 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,16 @@ "private": true, "scripts": { "dev": "next dev", + "lint:es": "eslint --ext .js,.jsx .", + "lint:fix": "eslint --fix --ext .js,.jsx .", "build": "next build", "start": "next start", - "lint": "next lint" + "lint": "next lint", + "export": "next export", + "clear-all": "rm -rf .next node_modules", + "re-start": "rm -rf .next node_modules && yarn install && yarn dev", + "re-build": "rm -rf .next node_modules && yarn install && yarn build" + }, "dependencies": { "@headlessui/react": "^1.7.14", diff --git a/runner.sh b/runner.sh new file mode 100755 index 0000000..51b91a0 --- /dev/null +++ b/runner.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +# Check if the '--dev' argument is provided +if [ "$1" == "--dev" ]; then + echo "Run development docker" + DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f docker-compose.yml up -d --build +else + echo "Run Production docker" + + git pull origin main + DOCKER_BUILDKIT=1 COMPOSE_DOCKER_CLI_BUILD=1 docker compose -f docker-compose.yml up -d --build +fi diff --git a/tsconfig.json b/tsconfig.json index 6a9c1a2..e2d9355 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,16 +14,33 @@ "isolatedModules": true, "jsx": "preserve", "incremental": true, + "paths": { + "@/*": ["./src/*"], + "@components/*": ["src/components/*"], + "@containers/*": ["src/containers/*"], + "@contexts/*": ["src/contexts/*"], + "@framework/*": ["src/framework/basic-rest/*"], + "@settings/*": ["src/settings/*"], + "@styles/*": ["src/styles/*"], + "@utils/*": ["src/utils/*"] + }, + + // "paths": { + // }, + "incremental": true, + "baseUrl": ".", "plugins": [ { "name": "next" } ], - "baseUrl": ".", - "paths": { - "@/*": ["./src/*"] - } }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + // "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], + "include": [ + "next-env.d.ts", + "additional.d.ts", + "src/**/*.ts", + "src/**/*.tsx" + ], "exclude": ["node_modules"] }