Initial commit for serverless
This commit is contained in:
commit
2122b393dc
|
|
@ -0,0 +1,24 @@
|
||||||
|
# Use an official Node.js image from the Docker Hub
|
||||||
|
FROM node:18
|
||||||
|
|
||||||
|
# Set the working directory inside the container
|
||||||
|
WORKDIR /
|
||||||
|
RUN npm config set registry https://registry.npmmirror.com
|
||||||
|
RUN npm install -g npm@10.8.2
|
||||||
|
# Copy package.json and package-lock.json (if available)
|
||||||
|
COPY package*.json ./
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN rm -rf node_modules package-lock.json && npm cache clean --force
|
||||||
|
|
||||||
|
# Install dependencies
|
||||||
|
RUN npm install --legacy-peer-deps
|
||||||
|
|
||||||
|
# Copy the rest of the application code
|
||||||
|
COPY . .
|
||||||
|
|
||||||
|
# Expose the port the app will run on
|
||||||
|
EXPOSE 8080
|
||||||
|
|
||||||
|
# Command to start the application
|
||||||
|
CMD ["node", "index.js"]
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
app: "Automation-serverLess-Git-hosted6095"
|
||||||
|
region: "asia-south1"
|
||||||
|
entrypoint: "index.js"
|
||||||
|
|
||||||
|
build:
|
||||||
|
builtin: dockerfile
|
||||||
|
ignorefile: .gitignore
|
||||||
|
|
||||||
|
env:
|
||||||
|
PORT: "8080"
|
||||||
|
|
@ -0,0 +1,15 @@
|
||||||
|
const express = require("express");
|
||||||
|
|
||||||
|
const app = express();
|
||||||
|
const PORT = 8080;
|
||||||
|
|
||||||
|
// Simple "Hello from Automation-serverLess-Git-hosted6095!" route
|
||||||
|
app.get("*", (req, res) => {
|
||||||
|
res.send("Hello, World!");
|
||||||
|
});
|
||||||
|
|
||||||
|
// Start server
|
||||||
|
app.listen(PORT, () => {
|
||||||
|
console.log(`Server is running on http://localhost:${PORT}`);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
{
|
||||||
|
"name": "dummy",
|
||||||
|
"version": "1.0.0",
|
||||||
|
"description": "",
|
||||||
|
"main": "index.js",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1"
|
||||||
|
},
|
||||||
|
"keywords": [],
|
||||||
|
"author": "",
|
||||||
|
"license": "ISC",
|
||||||
|
"dependencies": {
|
||||||
|
"express": "^4.21.2"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user