Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +13 -6
Dockerfile
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
|
|
| 1 |
FROM node:lts
|
| 2 |
|
| 3 |
# Set the working directory
|
| 4 |
WORKDIR /usr/src/app
|
| 5 |
|
| 6 |
-
# Install Angular CLI globally
|
| 7 |
-
RUN npm install -g @angular/cli
|
| 8 |
-
|
| 9 |
# Copy package.json and package-lock.json first to leverage Docker cache
|
| 10 |
COPY package*.json ./
|
| 11 |
|
|
|
|
|
|
|
|
|
|
| 12 |
# Install dependencies
|
| 13 |
RUN npm install
|
| 14 |
|
| 15 |
# Copy the rest of the application code
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
EXPOSE 7860
|
| 20 |
|
| 21 |
-
# Set
|
| 22 |
-
ENTRYPOINT bash -c "ng serve --host 0.0.0.0 --port 7860 --configuration=production --disable-host-check
|
|
|
|
| 1 |
+
# Use the official Node.js LTS version as the base image
|
| 2 |
FROM node:lts
|
| 3 |
|
| 4 |
# Set the working directory
|
| 5 |
WORKDIR /usr/src/app
|
| 6 |
|
|
|
|
|
|
|
|
|
|
| 7 |
# Copy package.json and package-lock.json first to leverage Docker cache
|
| 8 |
COPY package*.json ./
|
| 9 |
|
| 10 |
+
# Install Angular CLI globally
|
| 11 |
+
RUN npm install -g @angular/cli
|
| 12 |
+
|
| 13 |
# Install dependencies
|
| 14 |
RUN npm install
|
| 15 |
|
| 16 |
# Copy the rest of the application code
|
| 17 |
COPY . .
|
| 18 |
|
| 19 |
+
# Change ownership of the app directory to a non-root user (node)
|
| 20 |
+
RUN chown -R node:node /usr/src/app
|
| 21 |
+
|
| 22 |
+
# Switch to a non-root user for security
|
| 23 |
+
USER node
|
| 24 |
+
|
| 25 |
+
# Expose the port your application will run on
|
| 26 |
EXPOSE 7860
|
| 27 |
|
| 28 |
+
# Set the entry point for the container
|
| 29 |
+
ENTRYPOINT ["bash", "-c", "ng serve --host 0.0.0.0 --port 7860 --configuration=production --disable-host-check"]
|