2 Commits

Author SHA1 Message Date
root ea2ed9fc37 production 2 months ago
root 96ad2129bb update config 2 months ago
  1. 24
      Dockerfile
  2. 27
      Jenkinsfile
  3. 16
      docker-compose.yml
  4. 9
      next.config.js
  5. 9
      package.json
  6. 12
      runner.sh
  7. 27
      tsconfig.json

24
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"]

27
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"
}
}
}
}
}
}
}

16
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

9
next.config.js

@ -35,6 +35,15 @@ const nextConfig = {
}, },
], ],
}, },
typescript: {
ignoreBuildErrors: true,
},
eslint: {
ignoreDuringBuilds: true,
},
trailingSlash: true,
}; };
module.exports = nextConfig; module.exports = nextConfig;

9
package.json

@ -4,9 +4,16 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",
"lint:es": "eslint --ext .js,.jsx .",
"lint:fix": "eslint --fix --ext .js,.jsx .",
"build": "next build", "build": "next build",
"start": "next start", "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": { "dependencies": {
"@headlessui/react": "^1.7.14", "@headlessui/react": "^1.7.14",

12
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

27
tsconfig.json

@ -14,16 +14,33 @@
"isolatedModules": true, "isolatedModules": true,
"jsx": "preserve", "jsx": "preserve",
"incremental": true, "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": [ "plugins": [
{ {
"name": "next" "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"] "exclude": ["node_modules"]
} }
Loading…
Cancel
Save