File size: 1,323 Bytes
f0b42e2
51c6910
f0b42e2
51c6910
119e0ba
f0b42e2
 
 
 
 
 
 
 
 
 
 
 
 
51c6910
f0b42e2
51c6910
 
 
693d472
51c6910
 
f0b42e2
693d472
f0b42e2
693d472
51c6910
693d472
 
4a473dd
51c6910
 
 
f0b42e2
693d472
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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;'