Skip to content

Commit 7d94c53

Browse files
committed
dockerised
1 parent 1c09503 commit 7d94c53

File tree

8 files changed

+217
-33
lines changed

8 files changed

+217
-33
lines changed

.dockerignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
backend/.env
2+
backend/node_modules
3+
backend/build
4+
backend/vercel.json
5+
frontend/.env
6+
frontend/node_modules

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
/.dependencygraph
1+
/.dependencygraph
2+
.env.development
3+
.env.production

README.md

Lines changed: 91 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -77,31 +77,37 @@ Schedio provides a platform for students/employees, colleges/organizations, and
7777
## Features
7878

7979
### General Features
80-
1. User Authentication with email (forgot password support)
81-
2. Comprehensive skill dataset
82-
3. Plagiarism check using RapidAPI
83-
4. Upload support for videos, code files, and images
84-
5. Tree-like code structure viewer
85-
6. Code explanation powered by Gemini
80+
81+
1. User Authentication with email (forgot password support)
82+
2. Comprehensive skill dataset
83+
3. Plagiarism check using RapidAPI
84+
4. Upload support for videos, code files, and images
85+
5. Tree-like code structure viewer
86+
6. Code explanation powered by Gemini
8687
7. Session persistence for seamless user experience
88+
8789
###### Note:- T stands for Type
90+
8891
### T1 User Features (Student/Employee)
89-
1. View all projects
90-
2. Search projects by programming language
92+
93+
1. View all projects
94+
2. Search projects by programming language
9195
3. Tokenized search across projects
92-
4. Comment/Like functionality on projects
96+
4. Comment/Like functionality on projects
9397
5. Can be added as contributors by T2 users on project uploads.
9498
6. Add/Edit profile picture and custom Student Description
9599
7. Auto generates Description on Signing up
96100

97101
### T2 User Features (College/ Organisation)
102+
98103
1. View only their T1 users' projects.
99104
2. Monthly Analytics.
100105
3. Upload projects for T1 users.
101106
4. Auto-sync skills and projects with T1 profiles.
102107
5. View and download T1 user profiles as PDFs.
103108

104109
### T3 User Features (Recruiter)
110+
105111
1. Access to all projects.
106112
2. Comment on any project.
107113
3. Filter by Institute or Domain.
@@ -117,6 +123,7 @@ Schedio provides a platform for students/employees, colleges/organizations, and
117123
To run the project locally, follow these steps.
118124

119125
### Prerequisites
126+
120127
- Node.js & npm
121128
- MongoDB Database
122129
- Git
@@ -126,17 +133,20 @@ To run the project locally, follow these steps.
126133
### Installation
127134

128135
1. Clone the repository:
136+
129137
```sh
130138
git clone https://github.com/vsreddyh/schedio.git
131139
```
132140

133141
2. Install dependencies:
142+
134143
```sh
135144
cd frontend && npm install
136145
cd ../backend && npm install
137146
```
138147

139148
3. Create a `.env` file in the `./backend` folder with the following structure:
149+
140150
```env
141151
142152
PASSWORD=your-app-password
@@ -152,6 +162,66 @@ To run the project locally, follow these steps.
152162
npm run build && node index.js
153163
```
154164

165+
### Installation using Docker
166+
167+
1. Clone the repository:
168+
```sh
169+
git clone https://github.com/vsreddyh/schedio.git
170+
```
171+
172+
#### For Development
173+
174+
2. Create a `.env.development` file in the root folder with the following structure:
175+
176+
```env
177+
178+
PASSWORD=your-app-password
179+
JWT_SECRET=random-32-characters
180+
SESSION_KEY=random-32-characters
181+
plagarismapi=your-rapidapi-key
182+
geminiapi=your-gemini-api-key
183+
url=mongodb://your-connection-url/database-name?retryWrites=true&w=majority
184+
FRONTEND_URL=http://localhost:3000
185+
REACT_APP_BACKEND_URL=http://localhost:3001
186+
```
187+
188+
3. Build the image:
189+
190+
```sh
191+
docker build -f development.Dockerfile -t app-dev .
192+
```
193+
194+
4. Run the container:
195+
```sh
196+
docker run --env-file .env.development -p 3000:3000 -p 3001:3001 app-dev
197+
```
198+
199+
#### For Production
200+
201+
2. Create a `.env.production` file in the root folder with the following structure:
202+
203+
```env
204+
205+
PASSWORD=your-app-password
206+
JWT_SECRET=random-32-characters
207+
SESSION_KEY=random-32-characters
208+
plagarismapi=your-rapidapi-key
209+
geminiapi=your-gemini-api-key
210+
url=mongodb://your-connection-url/database-name?retryWrites=true&w=majority
211+
FRONTEND_URL=website-url
212+
```
213+
214+
3. Build the image:
215+
216+
```sh
217+
docker build -f production.Dockerfile --build-arg REACT_APP_BACKEND_URL="website-url" -t app-prod .
218+
```
219+
220+
4. Run the container:
221+
```sh
222+
docker run --env-file .env.production -p 3001:3001 app-prod
223+
```
224+
155225
---
156226

157227
## Contributing
@@ -165,16 +235,19 @@ We welcome contributions of all kinds! Whether it's bug reports, feature suggest
165235

166236
2. **Clone the Repository**
167237
Clone your forked repository locally to make changes:
238+
168239
```sh
169240
git clone https://github.com/your-username/schedio.git
170241
cd schedio
171242
```
172243

173244
3. **Create a New Branch**
174245
Use meaningful branch names to reflect the type of changes you are making:
246+
175247
```sh
176248
git checkout -b feature/your-feature-name
177249
```
250+
178251
_Example:_
179252
`feature/user-authentication` or `feature/fix-login-issue`
180253

@@ -183,12 +256,14 @@ We welcome contributions of all kinds! Whether it's bug reports, feature suggest
183256

184257
5. **Commit Your Changes**
185258
Write clear, concise commit messages to describe the changes you made:
259+
186260
```sh
187261
git commit -m "clear and concise commit name"
188262
```
189263

190264
6. **Push Your Branch to GitHub**
191265
Push the branch to your forked repository:
266+
192267
```sh
193268
git push origin feature/your-feature-name
194269
```
@@ -213,10 +288,12 @@ We welcome contributions of all kinds! Whether it's bug reports, feature suggest
213288
### Reporting Issues and Suggesting Features
214289

215290
If you encounter bugs or have ideas for new features, please open an issue:
216-
- **Report Bugs**: [Create a Bug Report](https://github.com/vsreddyh/schedio/issues/new?labels=bug)
217-
- **Request Features**: [Suggest a Feature](https://github.com/vsreddyh/schedio/issues/new?labels=enhancement)
291+
292+
- **Report Bugs**: [Create a Bug Report](https://github.com/vsreddyh/schedio/issues/new?labels=bug)
293+
- **Request Features**: [Suggest a Feature](https://github.com/vsreddyh/schedio/issues/new?labels=enhancement)
218294

219295
Make sure to:
296+
220297
- Provide as much detail as possible.
221298
- Include steps to reproduce bugs, if applicable.
222299

@@ -245,16 +322,17 @@ Your effort makes a huge difference! Every bug report, feature request, and pull
245322
![](https://github.com/vsreddyh/schedio/blob/main/frontend/public/Status.png?raw=true)<p style="text-align: center;">Log out option in T1 users</p>
246323

247324
![](https://github.com/vsreddyh/schedio/blob/main/frontend/public/college.png?raw=true)
248-
<p style="text-align: center;">Organization HomePage</p>
249325

326+
<p style="text-align: center;">Organization HomePage</p>
250327

251328
![](https://github.com/vsreddyh/schedio/blob/main/frontend/public/student_profile.png?raw=true)<p style="text-align: center;">Student Page viewed by T3,T2 users</p>
252329

253330
![](https://github.com/vsreddyh/schedio/blob/main/frontend/public/college_search.png?raw=true)
254-
<p style="text-align: center;">Filtering by college in Recruiter page</p>
255331

332+
<p style="text-align: center;">Filtering by college in Recruiter page</p>
256333

257334
![](https://github.com/vsreddyh/schedio/blob/main/frontend/public/Bookmark.png?raw=true)
335+
258336
<p style="text-align: center;">Bookmarks in recruiter page</p>
259337

260338
---

backend/.dockerignore

Lines changed: 0 additions & 4 deletions
This file was deleted.

backend/index.js

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,21 @@ const session = require("express-session");
77
const bodyParser = require("body-parser");
88
const approute = require("./route.js");
99
var MongoDBStore = require("connect-mongodb-session")(session);
10-
const port = process.env.PORT || 3001;
10+
const port = process.env.BACKEND_PORT || 3001;
1111

1212
const { SESSION_KEY, url, FRONTEND_URL } = require("./settings/env.js");
1313
app.use(
1414
cors({
15-
origin: process.env.NODE_ENV === 'production' ? 'https://schedio-coral.vercel.app' : 'http://localhost:3000',
15+
origin:
16+
process.env.NODE_ENV === "production"
17+
? FRONTEND_URL
18+
: "http://localhost:3000",
1619
credentials: true,
1720
}),
1821
);
19-
20-
app.use(express.static(path.join(__dirname, './build')));
22+
if (process.env.NODE_ENV === "production") {
23+
app.use(express.static(path.join(__dirname, "./build")));
24+
}
2125

2226
app.use(bodyParser.json({ limit: "50mb" })); //limit limits the data which can be uploaded to server.js from frontend
2327
const store = new MongoDBStore({
@@ -35,18 +39,19 @@ app.use(
3539
store: store,
3640
cookie: {
3741
maxAge: 6 * 60 * 60 * 1000, //6 hours
38-
sameSite: process.env.NODE_ENV === 'production'?"strict":"lax",
39-
secure: process.env.NODE_ENV === 'production',
42+
sameSite: process.env.NODE_ENV === "production" ? "strict" : "lax",
43+
secure: process.env.NODE_ENV === "production",
4044
httpOnly: true,
4145
rolling: true,
4246
},
4347
}),
4448
);
4549

46-
app.get('/', cors(), (req, res) => {
47-
res.sendFile(path.join(__dirname, './build', 'index.html'));
48-
})
49-
50+
app.get("/", cors(), (req, res) => {
51+
if (process.env.NODE_ENV === "production") {
52+
res.sendFile(path.join(__dirname, "./build", "index.html"));
53+
}
54+
});
5055

5156
app.use("/en", approute); //routing to all functions
5257

@@ -61,8 +66,8 @@ app.get("/checksessionexpiry", async (req, res) => {
6166
});
6267

6368
app.get("*", function (req, res) {
64-
if(process.env.NODE_ENV){
65-
res.sendFile(path.resolve(__dirname, './build', 'index.html'));
69+
if (process.env.NODE_ENV) {
70+
res.sendFile(path.resolve(__dirname, "./build", "index.html"));
6671
} else {
6772
console.log(req.path);
6873
res.status(404).send("This route does not exist");
@@ -72,6 +77,6 @@ app.get("*", function (req, res) {
7277
app.listen(port, function (req, res) {
7378
console.log(
7479
"server is running on Production:-",
75-
process.env.NODE_ENV ? "false" : "true",
80+
process.env.NODE_ENV == "production" ? "false" : "true",
7681
);
7782
});

development.Dockerfile

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# dev.Dockerfile
2+
FROM node:18
3+
4+
WORKDIR /app
5+
6+
# Install a helper to run both processes
7+
RUN npm install -g concurrently
8+
9+
# Install backend deps
10+
COPY backend/package*.json ./backend/
11+
RUN cd backend && npm install
12+
13+
# Install frontend deps
14+
COPY frontend/package*.json ./frontend/
15+
RUN cd frontend && npm install
16+
17+
# Copy sources
18+
COPY backend ./backend
19+
COPY frontend ./frontend
20+
21+
# Ensure servers bind to all interfaces in containers
22+
ENV HOST=0.0.0.0
23+
ENV PORT=3000
24+
ENV BACKEND_PORT=3001
25+
26+
# Accept secrets at runtime (populated via --env-file .env.development)
27+
ENV NODE_ENV=development
28+
ENV url=""
29+
ENV geminiapi=""
30+
ENV plagarismapi=""
31+
ENV SESSION_KEY=""
32+
ENV JWT_SECRET=""
33+
ENV PASSWORD=""
34+
ENV EMAIL=""
35+
ENV FRONTEND_URL=""
36+
ENV BUILD_PATH="../backend/build"
37+
# For React dev, this variable must be available to the dev server process
38+
ENV REACT_APP_BACKEND_URL="http://localhost:3001"
39+
40+
# Expose dev ports
41+
EXPOSE 3000 3001
42+
43+
# Forward backend env into the backend process; React dev server will read process.env at start
44+
# Your backend should read from process.env.* and your frontend dev server can reference
45+
# import.meta.env.* (Vite) or process.env.REACT_APP_* (CRA) as usual.
46+
CMD ["concurrently", \
47+
"npm:start --prefix backend", \
48+
"npm:start --prefix frontend"]
49+

frontend/.dockerignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)