Spaces:
Running
Running
| # Use the official Node.js 20 image. | |
| FROM node:20-alpine | |
| # Set the user to root to install pnpm globally | |
| USER root | |
| # Install pnpm | |
| RUN npm i -g pnpm | |
| # Set a non-root user for security | |
| USER 1000 | |
| # Set the working directory | |
| WORKDIR /usr/src/app | |
| # Copy package.json and pnpm-lock.yaml to the container | |
| COPY --chown=1000 package.json pnpm-lock.yaml ./ | |
| # Install dependencies | |
| RUN pnpm install | |
| # Copy the rest of the application files to the container | |
| COPY --chown=1000 . . | |
| # Build the Next.js application | |
| RUN pnpm build | |
| # Expose the application port | |
| EXPOSE 3000 | |
| # Start the application | |
| CMD ["pnpm", "start"] |