1
+ # Use the official Node.js image as the base image
2
+ FROM node:latest AS build_client
3
+
4
+ # Set the working directory inside the container
5
+ WORKDIR /app
6
+
7
+ # Copy the .git directory to the container to allow for the use of the git hash in the Vite project
8
+ COPY .git /app/.git
9
+
10
+ # Copy the package.json and package-lock.json files to the container
11
+ COPY client/ /app
12
+
13
+ ARG VITE_API_URL
14
+ ARG VITE_MAX_VM_COUNT
15
+
16
+ ENV VITE_API_URL=$VITE_API_URL
17
+ ENV VITE_MAX_VM_COUNT=$VITE_MAX_VM_COUNT
18
+
19
+ # Install the project dependencies
20
+ RUN npm install
21
+
22
+ # Build the Vite project
23
+ RUN npm run build
24
+
25
+ # Use the official Nginx image as the base image for serving the built files
26
+ FROM nginx:latest AS serve_client
27
+
28
+ # Copy the built files from the previous stage to the Nginx container
29
+ COPY --from=build_client /app/dist /usr/share/nginx/html
30
+
31
+ # Copy the Nginx configuration file to the container
32
+ COPY nginx/nginx.conf /etc/nginx/conf.d/default.conf
33
+
34
+ # Expose the port Nginx will listen on
35
+ ARG PORT
36
+
37
+ EXPOSE $PORT
38
+
39
+ # Start the Nginx server
40
+ CMD ["nginx" , "-g" , "daemon off;" ]
41
+
42
+ FROM python:3.12 AS build_server
43
+
44
+ # Set the working directory
45
+ WORKDIR /app
46
+
47
+ # Copy the current directory contents into the container at /server
48
+ COPY server/ /app
49
+
50
+ # Install qemu-system-x86_64
51
+ RUN apt-get update && apt-get install -y qemu-system
52
+
53
+ # Install any needed packages specified in requirements.txt
54
+ RUN pip install --no-cache-dir -r requirements.txt
55
+
56
+ # Run gunicorn
57
+ CMD ["gunicorn" , "app:app" ]
0 commit comments