# Stage 1: Build the Mirror server (assuming the Unity server build is already done) | |
FROM ubuntu:20.04 AS builder | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
xvfb \ | |
wine \ | |
wget \ | |
unzip \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set working directory | |
WORKDIR /app | |
# Copy the Unity build (assuming the build is in the 'build' directory) | |
COPY build/ ./ | |
# Make the server executable | |
RUN chmod +x ./server.x86_64 | |
# Stage 2: Setup Nginx and serve static files | |
FROM nginx:alpine AS webserver | |
# Copy static website files | |
COPY static-site/ /usr/share/nginx/html | |
# Copy Nginx configuration | |
COPY nginx.conf /etc/nginx/nginx.conf | |
# Stage 3: Run the Mirror server and Nginx in the final container | |
FROM ubuntu:20.04 | |
# Install dependencies | |
RUN apt-get update && apt-get install -y \ | |
xvfb \ | |
supervisor \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Copy the server files from the builder stage | |
COPY --from=builder /app /app | |
# Copy Nginx and static site from webserver stage | |
COPY --from=webserver /usr/share/nginx/html /usr/share/nginx/html | |
COPY --from=webserver /etc/nginx/nginx.conf /etc/nginx/nginx.conf | |
# Copy Supervisor configuration | |
COPY supervisord.conf /etc/supervisor/conf.d/supervisord.conf | |
# Expose ports for Nginx and the Mirror server | |
EXPOSE 7860 7777 | |
# Start Supervisor to manage both processes | |
CMD ["/usr/bin/supervisord"] | |