Update Dockerfile
Browse files- Dockerfile +5 -2
Dockerfile
CHANGED
|
@@ -1,12 +1,15 @@
|
|
| 1 |
FROM node:14-slim
|
| 2 |
|
|
|
|
|
|
|
|
|
|
| 3 |
ENV HOME=/home/user \
|
| 4 |
PATH=/home/user/.local/bin:$PATH
|
| 5 |
|
| 6 |
WORKDIR $HOME/app
|
| 7 |
|
| 8 |
# Copy application files
|
| 9 |
-
COPY .
|
| 10 |
|
| 11 |
# Install dependencies (if there are any Node.js dependencies, list them here)
|
| 12 |
RUN npm install
|
|
@@ -15,4 +18,4 @@ RUN npm install
|
|
| 15 |
EXPOSE 8080
|
| 16 |
|
| 17 |
# Command to run the script
|
| 18 |
-
CMD ["node", "run.js"]
|
|
|
|
| 1 |
FROM node:14-slim
|
| 2 |
|
| 3 |
+
# Create a non-root user
|
| 4 |
+
RUN useradd -m -u 1000 user
|
| 5 |
+
USER user
|
| 6 |
ENV HOME=/home/user \
|
| 7 |
PATH=/home/user/.local/bin:$PATH
|
| 8 |
|
| 9 |
WORKDIR $HOME/app
|
| 10 |
|
| 11 |
# Copy application files
|
| 12 |
+
COPY --chown=user . .
|
| 13 |
|
| 14 |
# Install dependencies (if there are any Node.js dependencies, list them here)
|
| 15 |
RUN npm install
|
|
|
|
| 18 |
EXPOSE 8080
|
| 19 |
|
| 20 |
# Command to run the script
|
| 21 |
+
CMD ["node", "run.js"]
|