Spaces:
Running
Running
Create Dockerfile
Browse files- Dockerfile +33 -0
Dockerfile
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use the official Node.js 20 image.
|
| 2 |
+
FROM node:20-alpine
|
| 3 |
+
|
| 4 |
+
# Set the user to root to install pnpm globally
|
| 5 |
+
USER root
|
| 6 |
+
|
| 7 |
+
# Install pnpm
|
| 8 |
+
RUN npm i -g pnpm
|
| 9 |
+
|
| 10 |
+
# Set a non-root user for security
|
| 11 |
+
USER 1000
|
| 12 |
+
|
| 13 |
+
# Set the working directory
|
| 14 |
+
WORKDIR /usr/src/app
|
| 15 |
+
|
| 16 |
+
# Copy package.json and pnpm-lock.yaml to the container
|
| 17 |
+
COPY --chown=1000 package.json pnpm-lock.yaml ./
|
| 18 |
+
|
| 19 |
+
# Install dependencies
|
| 20 |
+
RUN pnpm install
|
| 21 |
+
|
| 22 |
+
# Copy the rest of the application files to the container
|
| 23 |
+
COPY --chown=1000 . .
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
# Build the Next.js application
|
| 27 |
+
RUN pnpm build
|
| 28 |
+
|
| 29 |
+
# Expose the application port
|
| 30 |
+
EXPOSE 3000
|
| 31 |
+
|
| 32 |
+
# Start the application
|
| 33 |
+
CMD ["pnpm", "start"]
|