Create Dockerfile
Browse files- Dockerfile +53 -0
Dockerfile
ADDED
@@ -0,0 +1,53 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Stage 1: Build the Mirror server (assuming the Unity server build is already done)
|
2 |
+
FROM ubuntu:20.04 AS builder
|
3 |
+
|
4 |
+
# Install dependencies
|
5 |
+
RUN apt-get update && apt-get install -y \
|
6 |
+
xvfb \
|
7 |
+
wine \
|
8 |
+
wget \
|
9 |
+
unzip \
|
10 |
+
&& rm -rf /var/lib/apt/lists/*
|
11 |
+
|
12 |
+
# Set working directory
|
13 |
+
WORKDIR /app
|
14 |
+
|
15 |
+
# Copy the Unity build (assuming the build is in the 'build' directory)
|
16 |
+
COPY build/ ./
|
17 |
+
|
18 |
+
# Make the server executable
|
19 |
+
RUN chmod +x ./YourUnityServer.x86_64
|
20 |
+
|
21 |
+
# Stage 2: Setup Nginx and serve static files
|
22 |
+
FROM nginx:alpine AS webserver
|
23 |
+
|
24 |
+
# Copy static website files
|
25 |
+
COPY static-site/ /usr/share/nginx/html
|
26 |
+
|
27 |
+
# Copy Nginx configuration
|
28 |
+
COPY nginx.conf /etc/nginx/nginx.conf
|
29 |
+
|
30 |
+
# Stage 3: Run the Mirror server and Nginx in the final container
|
31 |
+
FROM ubuntu:20.04
|
32 |
+
|
33 |
+
# Install dependencies
|
34 |
+
RUN apt-get update && apt-get install -y \
|
35 |
+
xvfb \
|
36 |
+
supervisor \
|
37 |
+
&& rm -rf /var/lib/apt/lists/*
|
38 |
+
|
39 |
+
# Copy the server files from the builder stage
|
40 |
+
COPY --from=builder /app /app
|
41 |
+
|
42 |
+
# Copy Nginx and static site from webserver stage
|
43 |
+
COPY --from=webserver /usr/share/nginx/html /usr/share/nginx/html
|
44 |
+
COPY --from=webserver /etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
45 |
+
|
46 |
+
# Copy Supervisor configuration
|
47 |
+
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf
|
48 |
+
|
49 |
+
# Expose ports for Nginx and the Mirror server
|
50 |
+
EXPOSE 7860 7777
|
51 |
+
|
52 |
+
# Start Supervisor to manage both processes
|
53 |
+
CMD ["/usr/bin/supervisord"]
|