Spaces:
Build error
Build error
FROM node:18 | |
Default working dir | |
WORKDIR /opt/node_app | |
Get apt up and running | |
RUN apt update | |
RUN apt install python3-pip python3-uvicorn python3-fastapi -y | |
RUN apt install git yarn -y | |
RUN npm install --global yarn | |
RUN apt install nginx -y | |
RUN npm install react react-dom @excalidraw/excalidraw vscode-languageclient -g | |
Create a React | |
RUN npx create-react-app my-excalidraw-app | |
RUN git clone https://github.com/excalidraw/excalidraw | |
Change to the newly created directory | |
WORKDIR /opt/node_app/my-excalidraw-app | |
WORKDIR /opt/node_app/excalidraw | |
Set ENV on dev / prod | |
RUN echo -e "\n\nBROWSER=NONE" >> .env.development | |
RUN echo -e "\n\nBROWSER=NONE" >> .env.development | |
Setup npm / yarn / deps | |
RUN npm install react react-dom | |
RUN npm install workbox-build workbox-window eslint | |
RUN yarn add react react-dom @excalidraw/excalidraw workbox-build workbox-window eslint | |
Run yarn to install deps | |
RUN yarn | |
RUN yarn --ignore-optional --network-timeout 600000 && \ | |
chmod 777 -R /opt/node_app/ | |
Set prod build | |
ARG NODE_ENV=production | |
Build prod | |
RUN yarn build:app:docker && \ | |
# cp -R build/* /var/www/html | |
WORKDIR /opt/node_app/excalidraw/build | |
COPY . /var/www/html/ | |
COPY /opt/node_app/excalidraw/build /var/www/html | |
COPY /opt/node_app/excalidraw/build /var/www/html | |
RUN mkdir -p /opt/node_app/excalidraw/build | |
RUN echo "index.html" > /opt/node_app/excalidraw/build/index.html | |
WORKDIR /opt/node_app/ | |
WORKDIR /var/www/html/ | |
Copy fastapi app | |
COPY app.py . | |
COPY nginx.conf /etc/nginx/sites-available/default | |
RUN ls -a /var/www/html/ | |
RUN cat /var/www/html/index.html | |
Make port 3000 available outside the container | |
EXPOSE 5001 | |
Start the development server | |
CMD ["python3", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "3000"] | |
CMD ["python3", "app.py"] | |
CMD ["nginx", "-g", "daemon off;"] | |
CMD ["python3", "-m", "http.server", "3000"] | |
COPY start.sh . | |
RUN chmod +x start.sh | |
RUN yarn build | |
CMD /bin/bash start.sh | |
HEALTHCHECK CMD wget -q -O /dev/null http://localhost:5001 || exit 1 | |
CMD ["yarn", "start:production"] |