Spaces:
Build error
Build error
Create Dockerfile
Browse files- Dockerfile +52 -0
Dockerfile
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
FROM ubuntu:bionic as backend
|
| 2 |
+
|
| 3 |
+
# Install necessary packages for the backend server
|
| 4 |
+
RUN apt-get update && \
|
| 5 |
+
apt-get install -y libglu1 xvfb libxcursor1 net-tools
|
| 6 |
+
|
| 7 |
+
# Copy backend server files
|
| 8 |
+
COPY build/ /app/build/
|
| 9 |
+
COPY entrypoint.sh /entrypoint.sh
|
| 10 |
+
|
| 11 |
+
# Make entrypoint script executable
|
| 12 |
+
RUN chmod +x /entrypoint.sh && chmod +x /app/build/tanks.x86_64
|
| 13 |
+
|
| 14 |
+
# Create logs directory
|
| 15 |
+
RUN mkdir -p /app/logs
|
| 16 |
+
|
| 17 |
+
# Set workdir
|
| 18 |
+
WORKDIR /app/
|
| 19 |
+
|
| 20 |
+
FROM nginx:alpine as web_client
|
| 21 |
+
|
| 22 |
+
# Copy WebGL build files
|
| 23 |
+
COPY webgl-build /usr/share/nginx/html
|
| 24 |
+
|
| 25 |
+
# Copy Nginx configuration files
|
| 26 |
+
COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
| 27 |
+
COPY etc/nginx/conf.d /etc/nginx/conf.d
|
| 28 |
+
|
| 29 |
+
# Copy HTML page for port 7860
|
| 30 |
+
COPY html-page /usr/share/nginx/html-page
|
| 31 |
+
|
| 32 |
+
FROM ubuntu:bionic
|
| 33 |
+
|
| 34 |
+
# Install necessary packages for backend and Nginx
|
| 35 |
+
RUN apt-get update && \
|
| 36 |
+
apt-get install -y libglu1 xvfb libxcursor1 net-tools nginx
|
| 37 |
+
|
| 38 |
+
# Copy files from previous stages
|
| 39 |
+
COPY --from=backend /app/ /app/
|
| 40 |
+
COPY --from=web_client /usr/share/nginx/html /usr/share/nginx/html
|
| 41 |
+
COPY --from=web_client /usr/share/nginx/html-page /usr/share/nginx/html-page
|
| 42 |
+
COPY --from=web_client /etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
| 43 |
+
COPY --from=web_client /etc/nginx/conf.d /etc/nginx/conf.d
|
| 44 |
+
|
| 45 |
+
# Expose necessary ports
|
| 46 |
+
EXPOSE 80 7777/udp 7778/tcp 7860
|
| 47 |
+
|
| 48 |
+
# Entry point script
|
| 49 |
+
COPY entrypoint_combined.sh /entrypoint_combined.sh
|
| 50 |
+
RUN chmod +x /entrypoint_combined.sh
|
| 51 |
+
|
| 52 |
+
ENTRYPOINT ["/bin/bash", "/entrypoint_combined.sh"]
|