testdocker / Dockerfile
Mediocreatmybest's picture
Update Dockerfile
a97696b
raw
history blame
No virus
1 kB
FROM node:18
# 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
ARG PORT=5002
# 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/' .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 libcap2-bin -y && \
setcap cap_net_bind_service=+ep `readlink -f \`which node\``
RUN chmod +x start.sh
CMD /bin/bash start.sh