Spaces:
Paused
Paused
| FROM node:20 | |
| USER root | |
| # Create app directory and set permissions | |
| RUN mkdir -p /app && chown -R node:node /app | |
| # Install necessary dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| git \ | |
| ffmpeg \ | |
| imagemagick \ | |
| webp \ | |
| && apt-get clean \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Set the working directory | |
| WORKDIR /app | |
| # Clone the private GitHub repository using the GitHub token from Docker BuildKit secrets | |
| RUN --mount=type=secret,id=GITHUB_REPO,required=true \ | |
| --mount=type=secret,id=GITHUB_TOKEN,required=true \ | |
| git clone https://$(cat /run/secrets/GITHUB_TOKEN)@github.com/$(cat /run/secrets/GITHUB_REPO).git . | |
| # Switch to the node user | |
| COPY --chown=node:node . . | |
| RUN mkdir -p /app/lib/database && chown -R node:node /app/lib | |
| # Update npm to the latest version | |
| RUN npm install -g npm@latest | |
| RUN npm install node-cache | |
| RUN npm install | |
| EXPOSE 7860 | |
| ENV NODE_ENV=production | |
| CMD ["sh", "start.sh"] | |