-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile
58 lines (41 loc) · 1.25 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
# ---- FRONTEND ----
# Import the base image
FROM node:19-alpine as frontend-build
# Set the working directory
WORKDIR /app
# Install pnpm
RUN npm install -g pnpm
# Copy the package.json and pnpm-lock.yaml files
COPY package*.json ./
COPY pnpm-lock.yaml ./
# Install the dependencies
RUN pnpm install -P
# Copy the rest of the files
COPY . .
# Build the frontend
RUN pnpm run build
# ---- BACKEND ----
# Import the base image
FROM node:19-alpine as backend-build
# Set the working directory
WORKDIR /app
# Install and pnpm
RUN npm install -g pnpm
# Copy the package.json and pnpm-lock.yaml files
COPY /server/package*.json ./
COPY /server/pnpm-lock.yaml ./
# Install the dependencies
RUN pnpm install -P
# Install serve to serve the frontend
RUN npm install -g serve
# Copy the backend files
COPY /server/Server.js .
# Copy the build directory from the frontend-build stage
COPY --from=frontend-build /app/build /app/build
# Create the images directory where the images will be stored for the chat history and the frontend
RUN mkdir -p /server/images
# Expose the port on which the backend will listen and the frontend will be served
EXPOSE 3001
EXPOSE 5000
# Start the server and serve the frontend
CMD ["sh", "-c", "node Server.js & serve -s /app/build -l 5000"]