hfacemko commited on
Commit
90ca923
·
verified ·
1 Parent(s): c202512

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -47
Dockerfile CHANGED
@@ -1,57 +1,26 @@
1
- # Frontend build stage
2
- FROM node:18-slim AS frontend-builder
3
- WORKDIR /app
4
-
5
- # Install git
6
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
7
-
8
- # Clone the repository
9
- RUN git clone https://github.com/KenKout/CO3001.git .
10
-
11
- # Move to frontend directory and build
12
- WORKDIR /app/frontend
13
- RUN ls -la
14
- RUN npm install
15
- # Build with --no-lint flag to bypass ESLint errors
16
- RUN npm run build -- --no-lint
17
-
18
- # Backend build stage
19
- FROM python:3.11-slim AS backend-builder
20
- WORKDIR /app
21
-
22
- # Install git
23
- RUN apt-get update && apt-get install -y git && rm -rf /var/lib/apt/lists/*
24
-
25
- # Clone the repository
26
- RUN git clone https://github.com/KenKout/CO3001.git .
27
- RUN ls -la
28
-
29
- # Install Python dependencies
30
- RUN pip install --no-cache-dir -r requirements.txt
31
-
32
- # Final stage
33
  FROM node:18-slim
34
  WORKDIR /app
35
 
36
- # Install Python and required system dependencies
37
  RUN apt-get update && apt-get install -y \
38
  python3 \
39
  python3-pip \
 
40
  git \
41
  && rm -rf /var/lib/apt/lists/*
42
 
43
- # Copy backend from backend-builder
44
- COPY --from=backend-builder /usr/local/lib/python3.11/site-packages/ /usr/local/lib/python3.11/site-packages/
45
- COPY --from=backend-builder /app/app/ ./app/
46
 
47
- # Create frontend directory and copy frontend files
48
- RUN mkdir -p /app/frontend
49
- WORKDIR /app/frontend
 
50
 
51
- # Copy frontend from frontend-builder to /app/frontend
52
- COPY --from=frontend-builder /app/frontend/.next ./.next
53
- COPY --from=frontend-builder /app/frontend/package*.json ./
54
- COPY --from=frontend-builder /app/frontend/node_modules ./node_modules
55
 
56
  # Create public directory
57
  RUN mkdir -p public
@@ -61,11 +30,10 @@ ENV PYTHONUNBUFFERED=1
61
  ENV NODE_ENV=production
62
  ENV PORT=3000
63
 
64
- # Get entrypoint script from repository root
65
- COPY --from=backend-builder /app/entrypoint.sh /entrypoint.sh
66
- RUN chmod +x /entrypoint.sh
67
 
68
  EXPOSE 3000
69
  EXPOSE 8000
70
 
71
- ENTRYPOINT ["/entrypoint.sh"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  FROM node:18-slim
2
  WORKDIR /app
3
 
4
+ # Install system dependencies
5
  RUN apt-get update && apt-get install -y \
6
  python3 \
7
  python3-pip \
8
+ python3-venv \
9
  git \
10
  && rm -rf /var/lib/apt/lists/*
11
 
12
+ # Clone the repository
13
+ RUN git clone https://github.com/KenKout/CO3001.git .
 
14
 
15
+ # Install Python dependencies
16
+ RUN pip3 install --no-cache-dir -r requirements.txt --break-system-packages
17
+
18
+ COPY studyspace.db .
19
 
20
+ # Install and build frontend
21
+ WORKDIR /app/frontend
22
+ RUN npm install
23
+ RUN npm run build -- --no-lint
24
 
25
  # Create public directory
26
  RUN mkdir -p public
 
30
  ENV NODE_ENV=production
31
  ENV PORT=3000
32
 
33
+ # Make entrypoint script executable
34
+ RUN chmod +x /app/entrypoint.sh
 
35
 
36
  EXPOSE 3000
37
  EXPOSE 8000
38
 
39
+ ENTRYPOINT ["/app/entrypoint.sh"]