From 84aa6f316136a0edfac5cc69959280829275badb Mon Sep 17 00:00:00 2001 From: Kajal Thakur Date: Thu, 23 Jan 2025 19:34:59 +0530 Subject: [PATCH] Initial commit for serverless --- Dockerfile | 24 ++++++++++++++++++++++++ boltic.yaml | 10 ++++++++++ index.js | 15 +++++++++++++++ package.json | 16 ++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 Dockerfile create mode 100644 boltic.yaml create mode 100644 index.js create mode 100644 package.json diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..4908356 --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/boltic.yaml b/boltic.yaml new file mode 100644 index 0000000..11ea793 --- /dev/null +++ b/boltic.yaml @@ -0,0 +1,10 @@ +app: "Automation-serverLess-Git-hosted936" +region: "asia-south1" +entrypoint: "index.js" + +build: + builtin: dockerfile + ignorefile: .gitignore + +env: + PORT: "8080" diff --git a/index.js b/index.js new file mode 100644 index 0000000..9318a8e --- /dev/null +++ b/index.js @@ -0,0 +1,15 @@ +const express = require("express"); + +const app = express(); +const PORT = 8080; + +// Simple "Hello from Automation-serverLess-Git-hosted936!" route +app.get("*", (req, res) => { + res.send("Hello, World!"); +}); + +// Start server +app.listen(PORT, () => { + console.log(`Server is running on http://localhost:${PORT}`); +}); + diff --git a/package.json b/package.json new file mode 100644 index 0000000..09dd950 --- /dev/null +++ b/package.json @@ -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" + } + } +