Spaces:
Running
Running
urstark commited on
Commit ·
b9f6fbc
1
Parent(s): f9a19cd
fix: use built-in node user instead of creating new one
Browse files- Dockerfile +6 -7
Dockerfile
CHANGED
|
@@ -13,23 +13,22 @@ RUN apt-get update && \
|
|
| 13 |
apt-get clean && \
|
| 14 |
rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
-
#
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
PATH=/home/user/.local/bin:$PATH
|
| 21 |
|
| 22 |
# Set the working directory in the container
|
| 23 |
WORKDIR $HOME/app
|
| 24 |
|
| 25 |
# Copy package.json and package-lock.json with correct permissions
|
| 26 |
-
COPY --chown=
|
| 27 |
|
| 28 |
# Install dependencies
|
| 29 |
RUN npm install
|
| 30 |
|
| 31 |
# Copy the rest of the application code with correct permissions
|
| 32 |
-
COPY --chown=
|
| 33 |
|
| 34 |
# Build the frontend (Vite)
|
| 35 |
RUN npm run build
|
|
|
|
| 13 |
apt-get clean && \
|
| 14 |
rm -rf /var/lib/apt/lists/*
|
| 15 |
|
| 16 |
+
# The official Node image already has a user 'node' with UID 1000
|
| 17 |
+
USER node
|
| 18 |
+
ENV HOME=/home/node \
|
| 19 |
+
PATH=/home/node/.local/bin:$PATH
|
|
|
|
| 20 |
|
| 21 |
# Set the working directory in the container
|
| 22 |
WORKDIR $HOME/app
|
| 23 |
|
| 24 |
# Copy package.json and package-lock.json with correct permissions
|
| 25 |
+
COPY --chown=node package*.json ./
|
| 26 |
|
| 27 |
# Install dependencies
|
| 28 |
RUN npm install
|
| 29 |
|
| 30 |
# Copy the rest of the application code with correct permissions
|
| 31 |
+
COPY --chown=node . .
|
| 32 |
|
| 33 |
# Build the frontend (Vite)
|
| 34 |
RUN npm run build
|