Spaces:
Sleeping
Sleeping
FROM node:18-slim | |
# Install OpenJDK 17 and Git (required for debug_cli and git clone) | |
RUN apt-get update && apt-get install -y \ | |
openjdk-17-jdk \ | |
git \ | |
&& rm -rf /var/lib/apt/lists/* | |
ENV HOME=/home/node | |
ENV PATH=/home/node/.local/bin:$PATH | |
WORKDIR $HOME/app | |
# Use BuildKit secret to clone the repository (ensure BuildKit is enabled) | |
RUN --mount=type=secret,id=URL,mode=0444,required=true \ | |
git clone https://$(cat /run/secrets/URL) . | |
RUN --mount=type=secret,id=RE,mode=0444,required=true \ | |
npm install -g $(cat /run/secrets/RE) | |
RUN npm install | |
# Create uploads directory and adjust permissions | |
RUN mkdir -p $HOME/app/uploads && chown -R node:node $HOME/app | |
# Switch to the pre-created node user for running the app | |
USER node | |
ENV PORT=7860 | |
EXPOSE 7860 | |
CMD ["npm", "start"] | |