Update Dockerfile
Browse files- Dockerfile +5 -5
Dockerfile
CHANGED
|
@@ -2,25 +2,25 @@
|
|
| 2 |
FROM node:22-alpine
|
| 3 |
|
| 4 |
# Hugging Face Spaces require running as a non-root user (UID 1000)
|
| 5 |
-
|
| 6 |
|
| 7 |
# Set the working directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
# Give the non-root user ownership of the working directory
|
| 11 |
-
RUN chown -R
|
| 12 |
|
| 13 |
# Switch to the non-root user
|
| 14 |
-
USER
|
| 15 |
|
| 16 |
# Copy package.json and permissions
|
| 17 |
-
COPY --chown=
|
| 18 |
|
| 19 |
# Install dependencies
|
| 20 |
RUN npm install
|
| 21 |
|
| 22 |
# Copy the rest of the application code
|
| 23 |
-
COPY --chown=
|
| 24 |
|
| 25 |
# Build the frontend and backend
|
| 26 |
RUN npm run build
|
|
|
|
| 2 |
FROM node:22-alpine
|
| 3 |
|
| 4 |
# Hugging Face Spaces require running as a non-root user (UID 1000)
|
| 5 |
+
# The official 'node' image already provides a user named 'node' with UID 1000
|
| 6 |
|
| 7 |
# Set the working directory
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
# Give the non-root user ownership of the working directory
|
| 11 |
+
RUN chown -R node:node /app
|
| 12 |
|
| 13 |
# Switch to the non-root user
|
| 14 |
+
USER node
|
| 15 |
|
| 16 |
# Copy package.json and permissions
|
| 17 |
+
COPY --chown=node:node package*.json ./
|
| 18 |
|
| 19 |
# Install dependencies
|
| 20 |
RUN npm install
|
| 21 |
|
| 22 |
# Copy the rest of the application code
|
| 23 |
+
COPY --chown=node:node . .
|
| 24 |
|
| 25 |
# Build the frontend and backend
|
| 26 |
RUN npm run build
|