File size: 1,510 Bytes
51c6910
 
 
 
 
 
 
 
01ab88f
51c6910
072c9bf
 
 
 
51c6910
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
072c9bf
 
 
 
51c6910
 
 
 
01ab88f
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
44
45
46
47
48
49
50
51
52
53
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 entrypoint_combined.sh /app/entrypoint_combined.sh

# Set permissions and create logs directory
RUN chmod 755 /app/build/tanks.x86_64 && \
    chmod +x /app/entrypoint_combined.sh && \
    mkdir -p /app/logs

# Set workdir
WORKDIR /app/

FROM nginx:alpine as web_client

# Copy WebGL build files
COPY webgl-build /usr/share/nginx/html

# Copy Nginx configuration files
COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
COPY etc/nginx/conf.d /etc/nginx/conf.d

# Copy HTML page for port 7860
COPY html-page /usr/share/nginx/html-page

FROM ubuntu:bionic

# Install necessary packages for backend and Nginx
RUN apt-get update && \
    apt-get install -y libglu1 xvfb libxcursor1 net-tools nginx

# Copy files from previous stages
COPY --from=backend /app/ /app/
COPY --from=web_client /usr/share/nginx/html /usr/share/nginx/html
COPY --from=web_client /usr/share/nginx/html-page /usr/share/nginx/html-page
COPY --from=web_client /etc/nginx/nginx.conf /etc/nginx/nginx.conf
COPY --from=web_client /etc/nginx/conf.d /etc/nginx/conf.d

# Set permissions for Nginx log directory
RUN mkdir -p /var/log/nginx && \
    chown -R www-data:www-data /var/log/nginx

# Expose necessary ports
EXPOSE 80 7777/udp 7778/tcp 7860

# Entry point script
ENTRYPOINT ["/bin/bash", "/app/entrypoint_combined.sh"]