-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #135 from Puskar-Roy/dev
Dev
- Loading branch information
Showing
3 changed files
with
59 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
**/.DS_Store | ||
**/.env | ||
**/.git | ||
**/.idea | ||
**/.vscode | ||
**/dist | ||
**/node_modules | ||
**/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |