clone3 commited on
Commit
b9df4f3
·
verified ·
1 Parent(s): f0b42e2

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -26
Dockerfile CHANGED
@@ -1,33 +1,26 @@
1
- FROM ubuntu:bionic
2
 
3
- # Install necessary packages and Nginx
4
- RUN apt-get update && \
5
- apt-get upgrade -y && \
6
- apt-get install -y \
7
- libglu1 \
8
- xvfb \
9
- libxcursor1 \
10
- net-tools \
11
- nginx \
12
- debconf-utils \
13
- && apt-get clean && \
14
- rm -rf /var/lib/apt/lists/*
15
 
16
- # Set default configuration options to avoid prompts
17
- RUN echo 'nginx-common nginx-common/upgrade_type select none' | debconf-set-selections && \
18
- echo 'nginx-common nginx-common/upgrade select none' | debconf-set-selections
19
-
20
- # Copy configuration and application files
21
  COPY build/ /app/build/
22
  COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
23
  COPY etc/nginx/conf.d /etc/nginx/conf.d
24
  COPY webgl-build /usr/share/nginx/html
25
  COPY html-page /usr/share/nginx/html-page
26
 
27
- # Set permissions
28
  RUN chmod +x /app/build/tanks.x86_64 && \
29
- mkdir -p /app/logs /var/log/nginx /var/lib/nginx && \
30
- chown -R www-data:www-data /var/log/nginx /var/lib/nginx /app /usr/share/nginx/html /usr/share/nginx/html-page
 
 
 
 
 
 
31
 
32
  # Set workdir
33
  WORKDIR /app/
@@ -35,8 +28,5 @@ WORKDIR /app/
35
  # Expose necessary ports
36
  EXPOSE 80 7777/udp 7778/tcp 7860
37
 
38
- # Start the backend server and Nginx
39
- CMD xvfb-run -ae /dev/stdout \
40
- --server-args='-screen 0 640x480x24:32' \
41
- /app/build/tanks.x86_64 -batchmode -nographics -logfile /app/logs/server.log & \
42
- nginx -g 'daemon off;'
 
1
+ FROM nginx:alpine
2
 
3
+ # Install necessary packages for the backend server
4
+ RUN apk update && \
5
+ apk add --no-cache xvfb libxcursor bash
 
 
 
 
 
 
 
 
 
6
 
7
+ # Copy backend server files and set permissions
 
 
 
 
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 for directories and files
15
  RUN chmod +x /app/build/tanks.x86_64 && \
16
+ mkdir -p /app/logs && \
17
+ mkdir -p /var/log/nginx /var/lib/nginx /var/lib/nginx/body && \
18
+ chown -R nginx:nginx /app /usr/share/nginx/html /usr/share/nginx/html-page /var/log/nginx /var/lib/nginx && \
19
+ chmod 755 /var/log/nginx /var/lib/nginx /var/lib/nginx/body
20
+
21
+ # Copy and configure custom entrypoint script
22
+ COPY entrypoint.sh /entrypoint.sh
23
+ RUN chmod +x /entrypoint.sh
24
 
25
  # Set workdir
26
  WORKDIR /app/
 
28
  # Expose necessary ports
29
  EXPOSE 80 7777/udp 7778/tcp 7860
30
 
31
+ # Set the entrypoint to start the backend server and Nginx
32
+ ENTRYPOINT ["/entrypoint.sh"]