clone3 commited on
Commit
693d472
·
verified ·
1 Parent(s): 4a473dd

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +15 -37
Dockerfile CHANGED
@@ -6,51 +6,29 @@ RUN apt-get update && \
6
 
7
  # Copy backend server files
8
  COPY build/ /app/build/
9
- COPY entrypoint_combined.sh /app/entrypoint_combined.sh
10
-
11
- # Set permissions and create logs directory
12
- RUN chmod +x /app/build/tanks.x86_64 && \
13
- chmod +x /app/entrypoint_combined.sh && \
14
- mkdir -p /app/logs
15
-
16
- # Set workdir
17
- WORKDIR /app/
18
-
19
- FROM nginx:alpine as web_client
20
-
21
- # Copy WebGL build files
22
- COPY webgl-build /usr/share/nginx/html
23
-
24
- # Copy Nginx configuration files
25
  COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
26
  COPY etc/nginx/conf.d /etc/nginx/conf.d
27
-
28
- # Copy HTML page for port 7860
29
  COPY html-page /usr/share/nginx/html-page
30
 
31
- FROM ubuntu:bionic
 
 
 
 
32
 
33
- # Install necessary packages for backend and Nginx
34
  RUN apt-get update && \
35
- apt-get install -y libglu1 xvfb libxcursor1 net-tools nginx
36
 
37
- # Create necessary directories and set permissions
38
- RUN mkdir -p /var/log/nginx /var/lib/nginx && \
39
- chown -R www-data:www-data /var/log/nginx /var/lib/nginx
40
-
41
- # Copy files from previous stages
42
- COPY --from=backend /app/ /app/
43
- COPY --from=web_client /usr/share/nginx/html /usr/share/nginx/html
44
- COPY --from=web_client /usr/share/nginx/html-page /usr/share/nginx/html-page
45
- COPY --from=web_client /etc/nginx/nginx.conf /etc/nginx/nginx.conf
46
- COPY --from=web_client /etc/nginx/conf.d /etc/nginx/conf.d
47
-
48
- # Set permissions for the copied files
49
- RUN chown -R www-data:www-data /app /usr/share/nginx/html /usr/share/nginx/html-page && \
50
- chmod -R 755 /app/build /usr/share/nginx/html /usr/share/nginx/html-page
51
 
52
  # Expose necessary ports
53
  EXPOSE 80 7777/udp 7778/tcp 7860
54
 
55
- # Entry point script
56
- ENTRYPOINT ["/bin/bash", "/app/entrypoint_combined.sh"]
 
 
 
 
6
 
7
  # Copy backend server files
8
  COPY build/ /app/build/
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
10
  COPY etc/nginx/conf.d /etc/nginx/conf.d
11
+ COPY webgl-build /usr/share/nginx/html
 
12
  COPY html-page /usr/share/nginx/html-page
13
 
14
+ # Set permissions and create logs directory
15
+ RUN chmod +x /app/build/tanks.x86_64 && \
16
+ mkdir -p /app/logs && \
17
+ mkdir -p /var/log/nginx /var/lib/nginx && \
18
+ chown -R www-data:www-data /var/log/nginx /var/lib/nginx /app /usr/share/nginx/html /usr/share/nginx/html-page
19
 
20
+ # Install Nginx
21
  RUN apt-get update && \
22
+ apt-get install -y nginx
23
 
24
+ # Set workdir
25
+ WORKDIR /app/
 
 
 
 
 
 
 
 
 
 
 
 
26
 
27
  # Expose necessary ports
28
  EXPOSE 80 7777/udp 7778/tcp 7860
29
 
30
+ # Combine backend server and Nginx start commands
31
+ CMD xvfb-run -ae /dev/stdout \
32
+ --server-args='-screen 0 640x480x24:32' \
33
+ /app/build/tanks.x86_64 -batchmode -nographics -logfile /app/logs/server.log & \
34
+ nginx -g 'daemon off;'