Commit c8823720 authored by nilanjandaw's avatar nilanjandaw

fixed file paths

parent 1f5318fb
...@@ -16,7 +16,7 @@ let db = new Map() ...@@ -16,7 +16,7 @@ let db = new Map()
app.use(morgan('combined')) app.use(morgan('combined'))
app.use(bodyParser.urlencoded({ extended: false })) app.use(bodyParser.urlencoded({ extended: false }))
app.use(bodyParser.json()) app.use(bodyParser.json())
const file_path = __dirname + "/repository" const file_path = __dirname + "/repository/"
app.use('/repository', express.static(file_path)); app.use('/repository', express.static(file_path));
app.use(fileUpload()) app.use(fileUpload())
...@@ -42,7 +42,7 @@ app.post('/serverless/deploy', (req, res) => { ...@@ -42,7 +42,7 @@ app.post('/serverless/deploy', (req, res) => {
} }
else { else {
if (runtime === "container") { if (runtime === "container") {
deployContainer('./test/', functionHash) deployContainer('./repository/', functionHash)
.then(() => { .then(() => {
res.json({ res.json({
status: "success", status: "success",
...@@ -69,7 +69,7 @@ function deployContainer(path, imageName) { ...@@ -69,7 +69,7 @@ function deployContainer(path, imageName) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let buildStart = Date.now() let buildStart = Date.now()
fs.writeFile('./test/Dockerfile', fs.writeFile('./repository/Dockerfile',
`FROM node:latest `FROM node:latest
WORKDIR /app WORKDIR /app
COPY package.json /app COPY package.json /app
...@@ -85,7 +85,7 @@ function deployContainer(path, imageName) { ...@@ -85,7 +85,7 @@ function deployContainer(path, imageName) {
} }
else { else {
console.log('Dockerfile created'); console.log('Dockerfile created');
const process = spawn('docker', ["build", "-t", imageName, path, "-q"]); const process = spawn('docker', ["build", "-t", imageName, path]);
process.stdout.on('data', (data) => { process.stdout.on('data', (data) => {
console.log(`stdout: ${data}`); console.log(`stdout: ${data}`);
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
"express-fileupload": "^1.1.6", "express-fileupload": "^1.1.6",
"isolated-vm": "^3.0.0", "isolated-vm": "^3.0.0",
"morgan": "^1.9.1", "morgan": "^1.9.1",
"mqtt": "^3.0.0",
"nano": "^8.1.0", "nano": "^8.1.0",
"redis": "^2.8.0", "redis": "^2.8.0",
"save": "^2.4.0" "save": "^2.4.0"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment