Spaces:
Build error
Build error
FROM ubuntu:bionic as backend | |
# Install necessary packages for the backend server | |
RUN apt-get update && \ | |
apt-get install -y libglu1 xvfb libxcursor1 net-tools | |
# Copy backend server 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 and create logs directory | |
RUN chmod +x /app/build/tanks.x86_64 && \ | |
mkdir -p /app/logs && \ | |
mkdir -p /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 | |
# Install Nginx | |
RUN apt-get update && \ | |
apt-get install -y nginx | |
# Set workdir | |
WORKDIR /app/ | |
# Expose necessary ports | |
EXPOSE 80 7777/udp 7778/tcp 7860 | |
# Combine backend server and Nginx start commands | |
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;' | |