Skip to content

Commit

Permalink
Merge pull request #135 from Puskar-Roy/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
Puskar-Roy authored Oct 22, 2024
2 parents 8082135 + efcf78f commit f1be91e
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/APIs/OnlineBookSales_API/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
**/.DS_Store
**/.env
**/.git
**/.idea
**/.vscode
**/dist
**/node_modules
**/test
18 changes: 18 additions & 0 deletions packages/APIs/OnlineBookSales_API/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM node:alpine

WORKDIR /app

COPY . .

# Install npm dependencies
RUN npm install

# Set environment variables
ENV MONGO_URL=mongodb://localhost:27017/onlinebooksales
ENV PORT=3000
ENV COOKIE_EXPIRE=3000
ENV JWT_SECRET="YourJWTSecret"

EXPOSE 3000

CMD ["npm", "run", "dev"]
33 changes: 33 additions & 0 deletions packages/APIs/OnlineBookSales_API/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
version: '3'
services:
node-app:
build: . # This tells Docker Compose to use the Dockerfile in the current directory
container_name: node-container
ports:
- "3000:3000" # Expose the Node.js app on port 3000
environment:
MONGO_URL: mongodb://mongo:27017/onlinebooksales
PORT: 3000
COOKIE_EXPIRE: 3000
JWT_SECRET: YourJWTSecret # Pass env variables
depends_on:
- mongo # Ensure MongoDB starts before the Node.js app
networks:
- app-network

mongo:
image: mongo:latest # Use the latest MongoDB image
container_name: mongo-container
ports:
- "27017:27017" # Expose MongoDB on port 27017
volumes:
- mongo-data:/data/db # Persist MongoDB data
networks:
- app-network

volumes:
mongo-data: #To hold persitent data

networks:
app-network:
driver: bridge

0 comments on commit f1be91e

Please sign in to comment.