Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- 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
|
| 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 |
-
#
|
| 44 |
-
|
| 45 |
-
COPY --from=backend-builder /app/app/ ./app/
|
| 46 |
|
| 47 |
-
#
|
| 48 |
-
RUN
|
| 49 |
-
|
|
|
|
| 50 |
|
| 51 |
-
#
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 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 |
-
#
|
| 65 |
-
|
| 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"]
|