Spaces:
Runtime error
Runtime error
Update Dockerfile
Browse files- Dockerfile +9 -0
Dockerfile
CHANGED
|
@@ -1,9 +1,18 @@
|
|
| 1 |
# Use the official Node.js image as the base image
|
| 2 |
FROM node:14
|
| 3 |
|
|
|
|
|
|
|
|
|
|
| 4 |
# Set the working directory inside the container
|
| 5 |
WORKDIR /app
|
| 6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
# Copy package.json and package-lock.json to the working directory
|
| 8 |
COPY package*.json ./
|
| 9 |
|
|
|
|
| 1 |
# Use the official Node.js image as the base image
|
| 2 |
FROM node:14
|
| 3 |
|
| 4 |
+
# Create a non-root user and group
|
| 5 |
+
RUN groupadd -r appgroup && useradd -r -g appgroup -m appuser
|
| 6 |
+
|
| 7 |
# Set the working directory inside the container
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
+
# Change ownership of the working directory to the non-root user
|
| 11 |
+
RUN chown -R appuser:appgroup /app
|
| 12 |
+
|
| 13 |
+
# Switch to the non-root user
|
| 14 |
+
USER appuser
|
| 15 |
+
|
| 16 |
# Copy package.json and package-lock.json to the working directory
|
| 17 |
COPY package*.json ./
|
| 18 |
|