Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +13 -8
Dockerfile
CHANGED
|
@@ -44,17 +44,22 @@ WORKDIR /app
|
|
| 44 |
# Enable pnpm
|
| 45 |
RUN corepack enable
|
| 46 |
|
| 47 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
USER node
|
| 49 |
|
| 50 |
# Copy over the essential files from the builder stage
|
| 51 |
-
|
| 52 |
-
COPY --
|
| 53 |
-
COPY --
|
| 54 |
-
COPY --
|
| 55 |
-
|
| 56 |
-
# Create a directory for session data
|
| 57 |
-
RUN mkdir ./sessions
|
| 58 |
|
| 59 |
# Set the command to run your application using the "start" script.
|
| 60 |
CMD [ "pnpm", "start" ]
|
|
|
|
| 44 |
# Enable pnpm
|
| 45 |
RUN corepack enable
|
| 46 |
|
| 47 |
+
# Create the directory for session data AS THE ROOT USER
|
| 48 |
+
RUN mkdir ./sessions
|
| 49 |
+
|
| 50 |
+
# Change ownership of the entire app directory to the 'node' user.
|
| 51 |
+
# This must be done BEFORE switching to the node user.
|
| 52 |
+
RUN chown -R node:node /app
|
| 53 |
+
|
| 54 |
+
# NOW, switch to the built-in, non-root 'node' user for security
|
| 55 |
USER node
|
| 56 |
|
| 57 |
# Copy over the essential files from the builder stage
|
| 58 |
+
# These files will now be correctly owned by 'node' because of the chown command above.
|
| 59 |
+
COPY --from=builder /app/package.json ./package.json
|
| 60 |
+
COPY --from=builder /app/pnpm-lock.yaml* ./
|
| 61 |
+
COPY --from=builder /app/node_modules ./node_modules
|
| 62 |
+
COPY --from=builder /app/dist ./dist
|
|
|
|
|
|
|
| 63 |
|
| 64 |
# Set the command to run your application using the "start" script.
|
| 65 |
CMD [ "pnpm", "start" ]
|