[] init Project Back

This commit is contained in:
김선규 2024-07-24 04:44:37 +00:00
parent 22207f62d6
commit f59df58823
5 changed files with 3296 additions and 6 deletions

15
.gitignore vendored
View File

@ -1,6 +1,9 @@
./Dockerfile
./docker-compose.yml
./node_modules
./firebaseConfig.js
./front
./private
.DS_Store
/Dockerfile
/docker-compose.yml
/node_modules
# 보안 파일 위치 (서버에 직접 저장)
/private

49
Jenkinsfile vendored Executable file
View File

@ -0,0 +1,49 @@
pipeline {
agent any
environment {
DOCKER_CONTAINER_NAME = 'jjungtable-node'
APP_VOLUME_FRONT = '/home/node/app' // stein-node 컨테이너 내부 경로
}
stages {
stage('Clone Repository') {
steps {
git url: 'https://git.ipstein.myds.me/JJUNGTABLE_PJT/Back.git', branch: 'main'
}
}
stage('Deploy') {
steps {
script {
// Docker 컨테이너 ID 가져오기
def containerId = sh(script: "docker ps -qf 'name=${DOCKER_CONTAINER_NAME}'", returnStdout: true).trim()
if (containerId) {
// 컨테이너 내부로 파일 복사
sh "docker cp ${WORKSPACE}/. ${containerId}:${APP_VOLUME_FRONT}"
// 컨테이너 재시작
// sh "docker restart ${containerId}"
} else {
error "Docker container ${DOCKER_CONTAINER_NAME} not found"
}
}
}
}
}
post {
always {
script {
def containerId = sh(script: "docker ps -qf 'name=${DOCKER_CONTAINER_NAME}'", returnStdout: true).trim()
if (containerId) {
sh "docker logs ${containerId}"
} else {
echo "Docker container ${DOCKER_CONTAINER_NAME} not found"
}
}
}
failure {
echo "Build failed. Check the console output for details."
}
}
}

15
index.js Executable file
View File

@ -0,0 +1,15 @@
// index.js
import express from 'express';
const app = express();
const port = 7002;
app.get('/', (req, res) => {
res.send('Hello World!123123123123');
});
app.listen(port, () => {
console.log(`Server is running at http://localhost:${port}`);
});

3205
package-lock.json generated Executable file

File diff suppressed because it is too large Load Diff

18
package.json Normal file
View File

@ -0,0 +1,18 @@
{
"name": "JJTABLE",
"version": "1.0.0",
"description": "JJUNG TABLE",
"main": "index.js",
"type": "module",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js",
"build": "echo \"No build step defined\""
},
"keywords": [],
"author": "Team.Stein",
"license": "ISC",
"dependencies": {
"express": "^4.19.2"
}
}