File tree Expand file tree Collapse file tree 7 files changed +2948
-2298
lines changed Expand file tree Collapse file tree 7 files changed +2948
-2298
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
+ platform : linux/amd64
5
+ build :
6
+ context : ./peerprep-fe
7
+ dockerfile : Dockerfile
8
+ target : production
9
+ ports :
10
+ - " 3000:3000"
11
+ networks :
12
+ - peerprep-network
13
+ env_file :
14
+ - ./peerprep-fe/.env.production
15
+ question-service :
16
+ image : asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/question-svc:latest
17
+ platform : linux/amd64
18
+ build :
19
+ context : ./question-service
20
+ dockerfile : Dockerfile
21
+ target : production
22
+ ports :
23
+ - " 4001:4001"
24
+ networks :
25
+ - peerprep-network
26
+ env_file :
27
+ - ./question-service/.env.dev
28
+ user-service :
29
+ image : asia-southeast1-docker.pkg.dev/cs3219-g11-peerprep/cs3219-g11-repo/user-svc:latest
30
+ platform : linux/amd64
31
+ build :
32
+ context : ./user-service
33
+ dockerfile : Dockerfile
34
+ target : production
35
+ ports :
36
+ - " 3001:3001"
37
+ networks :
38
+ - peerprep-network
39
+ env_file :
40
+ - ./user-service/.env
41
+ networks :
42
+ peerprep-network :
43
+ driver : bridge
Original file line number Diff line number Diff line change @@ -4,14 +4,12 @@ services:
4
4
build :
5
5
context : ./peerprep-fe
6
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
7
+ target : development
8
+ volumes :
9
+ - ./peerprep-fe:/app
10
+ - ./peerprep-fe/node_modules:/ app/node_modules
11
11
ports :
12
12
- " 3000:3000"
13
- environment :
14
- - NODE_ENV=production
15
13
networks :
16
14
- peerprep-network
17
15
env_file :
@@ -21,14 +19,12 @@ services:
21
19
build :
22
20
context : ./question-service
23
21
dockerfile : Dockerfile
22
+ target : development
24
23
volumes :
25
- - ./question-service:/app # Mount src directory for hot reloading
24
+ - ./question-service:/app
26
25
- ./question-service/node_modules:/app/node_modules
27
26
ports :
28
27
- " 4001:4001"
29
- environment :
30
- - NODE_ENV=production
31
- - PORT=4001
32
28
networks :
33
29
- peerprep-network
34
30
env_file :
@@ -38,10 +34,12 @@ services:
38
34
build :
39
35
context : ./user-service
40
36
dockerfile : Dockerfile
37
+ target : development
38
+ volumes :
39
+ - ./user-service:/app
40
+ - ./user-service/node_modules:/app/node_modules
41
41
ports :
42
42
- " 3001:3001"
43
- environment :
44
- - NODE_ENV=production
45
43
networks :
46
44
- peerprep-network
47
45
env_file :
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
1
+ FROM node:18-alpine AS base
3
2
4
- # Install pnpm globally
5
3
RUN npm install -g pnpm
6
4
7
- # Set the working directory in the container
8
5
WORKDIR /app
9
6
10
7
# Copy package.json and pnpm-lock.yaml
11
8
COPY package*.json pnpm-lock.yaml ./
12
9
13
- # Install dependencies using pnpm
14
- RUN pnpm install
10
+ RUN pnpm install --frozen-lockfile
15
11
16
- # Install zustand explicitly (in case it's still not included)
12
+ # Install zustand explicitly
17
13
RUN pnpm add zustand
18
14
15
+ # Development stage
16
+ FROM base AS development
17
+ ENV NODE_ENV=development
18
+
19
19
# Copy the rest of the application code
20
20
COPY . .
21
21
22
- # Build the Next.js application
23
- RUN pnpm run build
22
+ # Note: Don't expose ports here, Compose will handle that for us
23
+
24
+ # Start the app in dev mode with hot-reloading
25
+ CMD ["pnpm" , "dev" ]
26
+
27
+
28
+ # Production stage
29
+ FROM base AS production
30
+ ENV NODE_ENV=production
31
+ ENV PORT=3000
32
+
33
+ COPY . .
34
+ RUN pnpm build
24
35
25
- # Expose the port the app runs on
26
- EXPOSE 3000
36
+ EXPOSE ${PORT}
27
37
28
- # Start the application
29
- CMD ["pnpm" , "start" ]
38
+ # Start the app in production mode
39
+ CMD ["pnpm" , "start" ]
You can’t perform that action at this time.
0 commit comments