Spaces:
Build error
Build error
Update Dockerfile
Browse files- Dockerfile +8 -5
Dockerfile
CHANGED
|
@@ -6,15 +6,18 @@ WORKDIR /app
|
|
| 6 |
# Create non-root user
|
| 7 |
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
|
| 8 |
|
| 9 |
-
# Copy files
|
| 10 |
-
COPY
|
| 11 |
RUN npm install
|
| 12 |
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
-
#
|
|
|
|
|
|
|
|
|
|
| 16 |
USER nextjs
|
| 17 |
|
| 18 |
-
# Expose and run
|
| 19 |
EXPOSE 7860
|
| 20 |
CMD ["npm", "run", "dev"]
|
|
|
|
| 6 |
# Create non-root user
|
| 7 |
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
|
| 8 |
|
| 9 |
+
# Copy files and set ownership
|
| 10 |
+
COPY package*.json ./
|
| 11 |
RUN npm install
|
| 12 |
|
| 13 |
+
# Copy source code as root
|
| 14 |
+
COPY . .
|
| 15 |
|
| 16 |
+
# Fix permissions so nextjs user can write to /app
|
| 17 |
+
RUN chown -R nextjs:nodejs /app
|
| 18 |
+
|
| 19 |
+
# Switch to non-root user
|
| 20 |
USER nextjs
|
| 21 |
|
|
|
|
| 22 |
EXPOSE 7860
|
| 23 |
CMD ["npm", "run", "dev"]
|