Skip to content

Commit

Permalink
Merge pull request #187 from alwinsimon/docker-configuration
Browse files Browse the repository at this point in the history
Docker configuration
  • Loading branch information
alwinsimon committed Sep 8, 2023
2 parents 9958bf0 + 81c2816 commit cfa90c1
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules/*
.env
28 changes: 28 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# ===================Server Port===================
PORT = 3000


# ===================MongoDB Url===================
MONGO_DB_URL = 'Paste mongodb url here'


# ===================Platform Name===================
PLATFORM_NAME = 'GetMyDeal'


# ===================Cookiee Key===================
SESSION_SECRET_KEY = 'Paste SESSION-SECRET-KEY here'


# ===================Payment Gateway Credentials - Razorpay===================
RAZORPAY_KEY_ID = "Paste RAZORPAY_KEY_ID here"

RAZORPAY_SECRET_KEY = "Paste RAZORPAY_SECRET_KEY here"


# ===================OTP Verification Service Credentials - Twilio ===================
TWILIO_ACCOUNT_SID = "Paste TWILIO_ACCOUNT_SID here"

TWILIO_AUTH_TOKEN = "Paste TWILIO_AUTH_TOKEN here"

TWILIO_VERIFY_SID = "Paste TWILIO_VERIFY_SID here"
23 changes: 23 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Command to configure the base image (official Node.js base image)
FROM node:18.16

# Command to update the base image
RUN apt update

# Set the working directory for the container
WORKDIR /app

# Command to copy the package files to working direcotory of the container
COPY package*.json .

# Install dependencies inside the container
RUN npm install

# Copy all the files from the existing directory to the docker container
COPY . .

# Command to set a fixed port for container to listen (exposing a port)
EXPOSE 3000

# Specify the default command to run the application inside the container
CMD ["npm", "start"]
15 changes: 15 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
version: "3"
services:
webserver:
build:
dockerfile: Dockerfile
context: ./
image: webserver-image:v1 # This will set the image name and tag while building the image from dockerfile using docker compose
container_name: webserver # This will set the container name while starting it from docker compose
ports:
- 3000:3000
restart: on-failure
# volumes:
# - .:/app
env_file:
- ./.env

0 comments on commit cfa90c1

Please sign in to comment.