-
Notifications
You must be signed in to change notification settings - Fork 136
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 #438 from vedantterse/dockerized-v
dockerized the app
- Loading branch information
Showing
6 changed files
with
97 additions
and
1 deletion.
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,22 @@ | ||
# Backend Dockerfile | ||
|
||
# Use the official Node.js image as a parent image | ||
FROM node:14 | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install backend dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Expose the port the app runs on (assuming default port 3000) | ||
EXPOSE 3000 | ||
|
||
# Start the application | ||
CMD ["npm", "start"] |
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
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,22 @@ | ||
# Frontend Dockerfile | ||
|
||
# Use the official Node.js image as a parent image | ||
FROM node:14 | ||
|
||
# Set the working directory | ||
WORKDIR /app | ||
|
||
# Copy package.json and package-lock.json | ||
COPY package*.json ./ | ||
|
||
# Install frontend dependencies | ||
RUN npm install | ||
|
||
# Copy the rest of the application code | ||
COPY . . | ||
|
||
# Expose the port the app runs on | ||
EXPOSE 5173 | ||
|
||
# Start the application | ||
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
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
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,34 @@ | ||
version: '3' | ||
|
||
services: | ||
frontend: | ||
build: | ||
context: ./frontend | ||
ports: | ||
- "5173:5173" | ||
depends_on: | ||
- backend | ||
- mongodb | ||
|
||
backend: | ||
build: | ||
context: ./backend | ||
ports: | ||
- "4000:4000" | ||
environment: | ||
NODE_ENV: development | ||
MONGO_URL: mongodb://mongodb:27017/ecommerce # MongoDB URI pointing to the MongoDB service | ||
PORT: 4000 | ||
STRIPE_SECRET_KEY: sk_test_51O96wfSH8i1UqUchc81vmn8Mka2bbbMrCW2vZKLEvGRTZDqWx2KlxkbLzdQnAJ0ipNA1UtO9Y83vX4x7KXjz5E4Z00JxrbAflY | ||
depends_on: | ||
- mongodb | ||
|
||
mongodb: | ||
image: mongo:latest | ||
ports: | ||
- "27017:27017" | ||
volumes: | ||
- mongo-data:/data/db | ||
|
||
volumes: | ||
mongo-data: |