-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile
66 lines (46 loc) · 1.46 KB
/
Dockerfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# Stage 1: Build stage for backend
FROM node:20-alpine as backend-build
# Set the working directory for the backend
WORKDIR /app/backend
# Copy backend package.json and package-lock.json
COPY backend/package*.json ./
# Install backend dependencies
RUN npm install
# Copy backend source code
COPY backend/ .
# Build the NestJS application
RUN npm run build
# Stage 2: Build stage for dashboard
FROM node:20-alpine as dashboard-build
# Set the working directory for the dashboard
WORKDIR /app/dashboard
# Copy dashboard package.json and package-lock.json
COPY dashboard/package*.json ./
# Install dashboard dependencies
RUN npm install
# Copy dashboard source code
COPY dashboard/ .
# Build the Next.js application
RUN npm run build
# Stage 3: Final stage
FROM node:20-alpine
# Install Supervisor
RUN apk update && \
apk add supervisor && \
mkdir -p /data/db /data/redis /var/log/supervisor
# Set the working directories for backend and dashboard
WORKDIR /app
# Copy the backend and dashboard build outputs from previous stages
COPY --from=backend-build /app/backend /app/backend
COPY --from=dashboard-build /app/dashboard /app/dashboard
# Copy Supervisor configuration
COPY supervisord.conf /etc/supervisord.conf
# Copy entrypoint script
COPY entrypoint.sh /usr/local/bin/
# Make entrypoint script executable
RUN chmod +x /usr/local/bin/entrypoint.sh
# Expose ports for the dashboard and backend
EXPOSE 3000
EXPOSE 5002
# Set the entrypoint
ENTRYPOINT ["entrypoint.sh"]