File tree Expand file tree Collapse file tree 9 files changed +223
-4
lines changed Expand file tree Collapse file tree 9 files changed +223
-4
lines changed Original file line number Diff line number Diff line change
1
+ services :
2
+ frontend :
3
+ image : asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest
4
+ build :
5
+ context : ./peerprep-fe
6
+ dockerfile : Dockerfile
7
+ # volumes:
8
+ # - ./peerprep-fe:/app # Mount src directory for hot reloading
9
+ # - /app/node_modules # Prevent overwriting node_modules
10
+ # - /app/.next
11
+ ports :
12
+ - " 3000:3000"
13
+ environment :
14
+ - NODE_ENV=production
15
+ networks :
16
+ - peerprep-network
17
+ env_file :
18
+ - ./peerprep-fe/.env.production
19
+ question-service :
20
+ image : asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest
21
+ build :
22
+ context : ./question-service
23
+ dockerfile : Dockerfile
24
+ volumes :
25
+ - ./question-service:/app # Mount src directory for hot reloading
26
+ - ./question-service/node_modules:/app/node_modules
27
+ ports :
28
+ - " 4001:4001"
29
+ environment :
30
+ - NODE_ENV=production
31
+ - PORT=4001
32
+ networks :
33
+ - peerprep-network
34
+ env_file :
35
+ - ./question-service/.env.dev
36
+ networks :
37
+ peerprep-network :
38
+ driver : bridge
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : peerprep-fe
5
+ labels :
6
+ type : frontend
7
+ app : peerprep-fe
8
+ spec :
9
+ selector :
10
+ matchLabels :
11
+ type : frontend
12
+ app : peerprep-fe
13
+ template :
14
+ metadata :
15
+ name : peerprep-fe
16
+ labels :
17
+ type : frontend
18
+ app : peerprep-fe
19
+ spec :
20
+ containers :
21
+ - name : peerprep-fe
22
+ image : asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/peerprep-fe:latest
23
+ # imagePullPolicy: Never # only used for local builds
24
+ ports :
25
+ - containerPort : 3000
26
+ ---
27
+ apiVersion : v1
28
+ kind : Service
29
+ metadata :
30
+ name : peerprep-fe
31
+ spec :
32
+ type : LoadBalancer
33
+ ports :
34
+ - port : 80
35
+ targetPort : 3000
36
+ selector :
37
+ type : frontend
38
+ app : peerprep-fe
39
+ ---
40
+ apiVersion : autoscaling/v2
41
+ kind : HorizontalPodAutoscaler
42
+ metadata :
43
+ name : peerprep-fe
44
+ spec :
45
+ scaleTargetRef :
46
+ apiVersion : apps/v1
47
+ kind : Deployment
48
+ name : peerprep-fe
49
+ minReplicas : 1
50
+ maxReplicas : 5
51
+ metrics :
52
+ - type : Resource
53
+ resource :
54
+ name : cpu
55
+ target :
56
+ type : Utilization
57
+ averageUtilization : 80
Original file line number Diff line number Diff line change
1
+ apiVersion : apps/v1
2
+ kind : Deployment
3
+ metadata :
4
+ name : question-svc
5
+ labels :
6
+ type : backend
7
+ app : question-svc
8
+ spec :
9
+ selector :
10
+ matchLabels :
11
+ type : backend
12
+ app : question-svc
13
+ template :
14
+ metadata :
15
+ name : question-svc
16
+ labels :
17
+ type : backend
18
+ app : question-svc
19
+ spec :
20
+ containers :
21
+ - name : question-svc
22
+ image : asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest
23
+ # imagePullPolicy: Never # only used for local builds
24
+ ports :
25
+ - containerPort : 4001
26
+ envFrom :
27
+ - configMapRef :
28
+ name : question-service-config
29
+ dnsPolicy : ClusterFirst
30
+ ---
31
+ # This is an internal service, not exposed
32
+ apiVersion : v1
33
+ kind : Service
34
+ metadata :
35
+ name : question-svc
36
+ spec :
37
+ type : LoadBalancer
38
+ ports :
39
+ - port : 4001
40
+ targetPort : 4001
41
+ selector :
42
+ type : backend
43
+ app : question-svc
44
+ ---
45
+ apiVersion : autoscaling/v2
46
+ kind : HorizontalPodAutoscaler
47
+ metadata :
48
+ name : question-svc
49
+ spec :
50
+ scaleTargetRef :
51
+ apiVersion : apps/v1
52
+ kind : Deployment
53
+ name : question-svc
54
+ minReplicas : 1
55
+ maxReplicas : 5
56
+ metrics :
57
+ - type : Resource
58
+ resource :
59
+ name : cpu
60
+ target :
61
+ type : Utilization
62
+ averageUtilization : 80
Original file line number Diff line number Diff line change
1
+ . /node_modules
2
+ .next
3
+ .git
4
+ .env * .local
Original file line number Diff line number Diff line change
1
+ # Use an official Node runtime as the base image
2
+ FROM node:18-alpine
3
+
4
+ # Install pnpm globally
5
+ RUN npm install -g pnpm
6
+
7
+ # Set the working directory in the container
8
+ WORKDIR /app
9
+
10
+ # Copy package.json and pnpm-lock.yaml
11
+ COPY package*.json pnpm-lock.yaml ./
12
+
13
+ # Install dependencies using pnpm
14
+ RUN pnpm install
15
+
16
+ # Install zustand explicitly (in case it's still not included)
17
+ RUN pnpm add zustand
18
+
19
+ # Copy the rest of the application code
20
+ COPY . .
21
+
22
+ # Build the Next.js application
23
+ RUN pnpm run build
24
+
25
+ # Expose the port the app runs on
26
+ EXPOSE 3000
27
+
28
+ # Start the application
29
+ CMD ["pnpm" , "start" ]
Original file line number Diff line number Diff line change
1
+ Dockerfile
2
+ .dockerignore
3
+ node_modules
4
+ npm-debug.log
5
+ dist
Original file line number Diff line number Diff line change
1
+ FROM node:18-alpine
2
+
3
+ RUN npm install -g pnpm
4
+
5
+ # Copy package.json and package-lock.json
6
+ COPY package*.json ./
7
+
8
+ # Install any dependencies
9
+ RUN pnpm install
10
+
11
+ # Bundle app source inside the Docker image
12
+ COPY src ./src
13
+
14
+ COPY tsconfig.json ./tsconfig.json
15
+
16
+ RUN pnpm run build
17
+
18
+ # Make port 4001 available to the world outside this container
19
+ ENV PORT=4001
20
+
21
+ EXPOSE ${PORT}
22
+
23
+ # Define the command to run your app
24
+ CMD ["pnpm" , "start" ]
Original file line number Diff line number Diff line change 22
22
"express" : " ^4.21.0" ,
23
23
"mongodb" : " ^6.9.0" ,
24
24
"mongoose" : " ^8.6.3" ,
25
- "prettier" : " ^3.3.3" ,
26
25
"zod" : " ^3.23.8"
27
26
},
28
27
"devDependencies" : {
32
31
"@types/mongoose" : " ^5.11.96" ,
33
32
"@types/node" : " ^22.6.1" ,
34
33
"nodemon" : " ^3.1.7" ,
34
+ "prettier" : " ^3.3.3" ,
35
35
"ts-node" : " ^10.9.2" ,
36
36
"typescript" : " ^5.6.2"
37
37
}
You can’t perform that action at this time.
0 commit comments