Spaces:
Build error
Build error
Commit
·
8c30656
1
Parent(s):
34dc73a
Update Dockerfile
Browse files- Dockerfile +30 -33
Dockerfile
CHANGED
@@ -1,50 +1,46 @@
|
|
1 |
FROM node:18
|
2 |
-
|
3 |
# Set default user and working dir
|
4 |
WORKDIR /opt/node_app
|
5 |
RUN chown -R 1000:1000 /opt/node_app
|
6 |
USER 1000
|
7 |
|
8 |
# Set production build
|
9 |
-
|
10 |
-
ENV PORT=5002
|
11 |
|
12 |
-
# Git Clone
|
13 |
RUN git clone https://github.com/excalidraw/excalidraw
|
14 |
-
|
15 |
|
16 |
-
#
|
17 |
-
|
18 |
-
|
19 |
|
20 |
-
# BUild excalidraw
|
21 |
WORKDIR /opt/node_app/excalidraw
|
22 |
-
#
|
23 |
-
#RUN sed -i 's/VITE_APP_WS_SERVER_URL=/VITE_APP_WS_SERVER_URL=http:\/\/localhost
|
24 |
-
|
25 |
-
# Install additional options and deps
|
26 |
-
RUN npm install react react-dom
|
27 |
-
#react-scripts canvas node
|
28 |
-
|
29 |
-
|
30 |
-
#vite vite-plugin-svgr @vitejs/plugin-react \
|
31 |
-
#vite-plugin-ejs vite-plugin-pwa vite-plugin-checker
|
32 |
|
|
|
|
|
33 |
#RUN npm install workbox-build workbox-window eslint
|
34 |
#RUN yarn add react react-dom @excalidraw/excalidraw workbox-build workbox-window eslint
|
35 |
|
36 |
# Run yarn to install deps
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
#
|
42 |
-
#
|
|
|
43 |
|
|
|
|
|
|
|
|
|
44 |
|
45 |
-
# Make port
|
46 |
EXPOSE 5001
|
47 |
-
EXPOSE 5002
|
48 |
|
49 |
# Start the development server
|
50 |
#CMD ["python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "3000"]
|
@@ -52,15 +48,16 @@ EXPOSE 5002
|
|
52 |
#CMD ["nginx", "-g", "daemon off;"]
|
53 |
#CMD ["python3", "-m", "http.server", "3000"]
|
54 |
COPY start.sh .
|
55 |
-
|
56 |
# switch back to root to execute start commands
|
57 |
USER root
|
58 |
|
59 |
-
# Switch to root working dir
|
60 |
-
WORKDIR /opt/node_app/excalidraw
|
61 |
|
62 |
-
#
|
63 |
-
|
|
|
|
|
64 |
|
65 |
RUN chmod +x start.sh
|
66 |
-
CMD
|
|
|
|
|
|
1 |
FROM node:18
|
2 |
+
|
3 |
# Set default user and working dir
|
4 |
WORKDIR /opt/node_app
|
5 |
RUN chown -R 1000:1000 /opt/node_app
|
6 |
USER 1000
|
7 |
|
8 |
# Set production build
|
9 |
+
ARG NODE_ENV=production
|
|
|
10 |
|
11 |
+
# Git Clone
|
12 |
RUN git clone https://github.com/excalidraw/excalidraw
|
13 |
+
RUN git clone https://github.com/excalidraw/excalidraw-room
|
14 |
|
15 |
+
# Change to the newly created directory
|
16 |
+
WORKDIR /opt/node_app/excalidraw-room
|
17 |
+
RUN yarn && yarn build
|
18 |
|
|
|
19 |
WORKDIR /opt/node_app/excalidraw
|
20 |
+
# Set app server to localhost
|
21 |
+
#RUN sed -i 's/VITE_APP_WS_SERVER_URL=/VITE_APP_WS_SERVER_URL=http:\/\/localhost/' .env.production
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
|
23 |
+
# Setup npm / yarn / deps
|
24 |
+
#RUN npm install react react-dom
|
25 |
#RUN npm install workbox-build workbox-window eslint
|
26 |
#RUN yarn add react react-dom @excalidraw/excalidraw workbox-build workbox-window eslint
|
27 |
|
28 |
# Run yarn to install deps
|
29 |
+
RUN yarn --ignore-optional --network-timeout 600000
|
30 |
+
|
31 |
+
# Build docker version
|
32 |
+
#RUN yarn build:app:docker && \
|
33 |
+
# cp -R build/* /var/www/html
|
34 |
+
#WORKDIR /opt/node_app/excalidraw/build
|
35 |
+
#COPY . /var/www/html/
|
36 |
|
37 |
+
#RUN mkdir -p /opt/node_app/excalidraw/build
|
38 |
+
#RUN echo "index.html" > /opt/node_app/excalidraw/build/index.html
|
39 |
+
#WORKDIR /opt/node_app/
|
40 |
+
#WORKDIR /var/www/html/
|
41 |
|
42 |
+
# Make port 3000 available outside the container
|
43 |
EXPOSE 5001
|
|
|
44 |
|
45 |
# Start the development server
|
46 |
#CMD ["python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "3000"]
|
|
|
48 |
#CMD ["nginx", "-g", "daemon off;"]
|
49 |
#CMD ["python3", "-m", "http.server", "3000"]
|
50 |
COPY start.sh .
|
|
|
51 |
# switch back to root to execute start commands
|
52 |
USER root
|
53 |
|
|
|
|
|
54 |
|
55 |
+
# Let Node access port 80
|
56 |
+
RUN apt update && \
|
57 |
+
apt install libcap2-bin && \
|
58 |
+
setcap cap_net_bind_service=+ep `readlink -f \`which node\``
|
59 |
|
60 |
RUN chmod +x start.sh
|
61 |
+
CMD /bin/bash start.sh
|
62 |
+
#HEALTHCHECK CMD wget -q -O /dev/null http://localhost:5001 || exit 1
|
63 |
+
#CMD ["yarn", "start:production"]
|