Spaces:
Build error
Build error
Update Dockerfile
Browse files- 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 |
-
|
|
|
|
|
|
|
|
|
32 |
|
33 |
-
# Install
|
34 |
RUN apt-get update && \
|
35 |
-
apt-get install -y
|
36 |
|
37 |
-
#
|
38 |
-
|
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 |
-
#
|
56 |
-
|
|
|
|
|
|
|
|
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;'
|