Update Dockerfile
Browse files- Dockerfile +8 -3
Dockerfile
CHANGED
|
@@ -7,14 +7,19 @@ ENV HOME=/home/appuser
|
|
| 7 |
ENV APP_HOME=${HOME}/app
|
| 8 |
WORKDIR ${APP_HOME}
|
| 9 |
|
|
|
|
|
|
|
| 10 |
COPY package*.json ./
|
| 11 |
RUN npm install
|
| 12 |
|
| 13 |
-
|
|
|
|
| 14 |
|
| 15 |
-
|
| 16 |
-
|
|
|
|
| 17 |
|
|
|
|
| 18 |
USER appuser
|
| 19 |
|
| 20 |
EXPOSE 7860
|
|
|
|
| 7 |
ENV APP_HOME=${HOME}/app
|
| 8 |
WORKDIR ${APP_HOME}
|
| 9 |
|
| 10 |
+
# Copy package files and install dependencies
|
| 11 |
+
# This creates node_modules owned by root for now
|
| 12 |
COPY package*.json ./
|
| 13 |
RUN npm install
|
| 14 |
|
| 15 |
+
# Copy the rest of the application source code
|
| 16 |
+
COPY . .
|
| 17 |
|
| 18 |
+
# Change ownership of the entire application directory to appuser
|
| 19 |
+
# This is the key fix. It makes the previous mkdir/chown redundant.
|
| 20 |
+
RUN chown -R appuser:appuser ${APP_HOME}
|
| 21 |
|
| 22 |
+
# Switch to the non-root user
|
| 23 |
USER appuser
|
| 24 |
|
| 25 |
EXPOSE 7860
|