Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +18 -9
Dockerfile
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
-
|
|
|
2 |
|
3 |
-
# Install necessary packages
|
4 |
RUN apt-get update && \
|
5 |
apt-get install -y \
|
6 |
xvfb \
|
@@ -14,14 +15,10 @@ RUN apt-get update && \
|
|
14 |
RUN mkdir -p /app/build /var/log/nginx /var/lib/nginx /var/cache/nginx /usr/share/nginx/html /usr/share/nginx/html-page && \
|
15 |
chown -R www-data:www-data /var/log/nginx /var/lib/nginx /var/cache/nginx /usr/share/nginx/html /usr/share/nginx/html-page
|
16 |
|
17 |
-
# Copy backend server files
|
18 |
COPY build/ /app/build/
|
19 |
-
|
20 |
-
# Copy Nginx configuration files
|
21 |
COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
22 |
COPY etc/nginx/conf.d /etc/nginx/conf.d
|
23 |
-
|
24 |
-
# Copy webgl build and HTML page
|
25 |
COPY webgl-build /usr/share/nginx/html
|
26 |
COPY html-page /usr/share/nginx/html-page
|
27 |
|
@@ -29,8 +26,20 @@ COPY html-page /usr/share/nginx/html-page
|
|
29 |
COPY entrypoint.sh /entrypoint.sh
|
30 |
RUN chmod +x /entrypoint.sh
|
31 |
|
32 |
-
#
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
35 |
# Expose necessary ports
|
36 |
EXPOSE 80 7777/udp 7778/tcp 7860
|
|
|
1 |
+
# Stage 1: Build and configure environment
|
2 |
+
FROM ubuntu:bionic AS build
|
3 |
|
4 |
+
# Install necessary packages and dependencies
|
5 |
RUN apt-get update && \
|
6 |
apt-get install -y \
|
7 |
xvfb \
|
|
|
15 |
RUN mkdir -p /app/build /var/log/nginx /var/lib/nginx /var/cache/nginx /usr/share/nginx/html /usr/share/nginx/html-page && \
|
16 |
chown -R www-data:www-data /var/log/nginx /var/lib/nginx /var/cache/nginx /usr/share/nginx/html /usr/share/nginx/html-page
|
17 |
|
18 |
+
# Copy backend server files and Nginx configuration
|
19 |
COPY build/ /app/build/
|
|
|
|
|
20 |
COPY etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
21 |
COPY etc/nginx/conf.d /etc/nginx/conf.d
|
|
|
|
|
22 |
COPY webgl-build /usr/share/nginx/html
|
23 |
COPY html-page /usr/share/nginx/html-page
|
24 |
|
|
|
26 |
COPY entrypoint.sh /entrypoint.sh
|
27 |
RUN chmod +x /entrypoint.sh
|
28 |
|
29 |
+
# Stage 2: Runtime
|
30 |
+
FROM nginx:alpine
|
31 |
+
|
32 |
+
# Copy the Nginx configuration and application from the build stage
|
33 |
+
COPY --from=build /etc/nginx/nginx.conf /etc/nginx/nginx.conf
|
34 |
+
COPY --from=build /etc/nginx/conf.d /etc/nginx/conf.d
|
35 |
+
COPY --from=build /usr/share/nginx/html /usr/share/nginx/html
|
36 |
+
COPY --from=build /usr/share/nginx/html-page /usr/share/nginx/html-page
|
37 |
+
COPY --from=build /app/build /app/build
|
38 |
+
COPY --from=build /entrypoint.sh /entrypoint.sh
|
39 |
+
|
40 |
+
# Ensure the correct permissions for directories
|
41 |
+
RUN mkdir -p /var/log/nginx /var/lib/nginx /var/cache/nginx && \
|
42 |
+
chown -R www-data:www-data /var/log/nginx /var/lib/nginx /var/cache/nginx
|
43 |
|
44 |
# Expose necessary ports
|
45 |
EXPOSE 80 7777/udp 7778/tcp 7860
|