FROM ubuntu:bionic # Install necessary packages and Nginx RUN apt-get update && \ apt-get upgrade -y && \ apt-get install -y \ libglu1 \ xvfb \ libxcursor1 \ net-tools \ nginx \ debconf-utils \ && apt-get clean && \ rm -rf /var/lib/apt/lists/* # Set default configuration options to avoid prompts RUN echo 'nginx-common nginx-common/upgrade_type select none' | debconf-set-selections && \ echo 'nginx-common nginx-common/upgrade select none' | debconf-set-selections # Copy configuration and application files COPY build/ /app/build/ COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf COPY etc/nginx/conf.d /etc/nginx/conf.d COPY webgl-build /usr/share/nginx/html COPY html-page /usr/share/nginx/html-page # Set permissions RUN chmod +x /app/build/tanks.x86_64 && \ mkdir -p /app/logs /var/log/nginx /var/lib/nginx && \ chown -R www-data:www-data /var/log/nginx /var/lib/nginx /app /usr/share/nginx/html /usr/share/nginx/html-page # Set workdir WORKDIR /app/ # Expose necessary ports EXPOSE 80 7777/udp 7778/tcp 7860 # Start the backend server and Nginx CMD xvfb-run -ae /dev/stdout \ --server-args='-screen 0 640x480x24:32' \ /app/build/tanks.x86_64 -batchmode -nographics -logfile /app/logs/server.log & \ nginx -g 'daemon off;'