testdocker / Dockerfile
Mediocreatmybest's picture
Update Dockerfile
0d99e1a
raw
history blame
No virus
1.04 kB
FROM node:18
# Install global
RUN npm install pm2 -g
# Set default user and working dir
WORKDIR /opt/node_app
RUN chown -R 1000:1000 /opt/node_app
USER 1000
# Set production build
ARG NODE_ENV=production
# Git Clone
RUN git clone https://github.com/excalidraw/excalidraw
RUN git clone https://github.com/excalidraw/excalidraw-room
# Change to the newly created directory
WORKDIR /opt/node_app/excalidraw-room
RUN yarn && yarn build
WORKDIR /opt/node_app/excalidraw
# Set app server to localhost
#RUN sed -i 's/VITE_APP_WS_SERVER_URL=/VITE_APP_WS_SERVER_URL=http:\/\/localhost:5002/' .env.production
# Run yarn to install deps
RUN yarn --ignore-optional --network-timeout 600000
# Make port 3000 available outside the container
EXPOSE 5001
# Copy start file
COPY start.sh .
# switch back to root to execute start commands
USER root
# Let Node access port 80
RUN apt update && \
apt install iproute2 libcap2-bin -y && \
setcap cap_net_bind_service=+ep `readlink -f \`which node\``
RUN chmod +x start.sh
CMD /bin/bash start.sh