Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +18 -12
Dockerfile
CHANGED
|
@@ -1,18 +1,24 @@
|
|
| 1 |
-
|
|
|
|
| 2 |
|
| 3 |
-
#
|
| 4 |
-
WORKDIR /
|
| 5 |
|
| 6 |
-
#
|
| 7 |
-
# A wildcard is used to ensure both package.json AND package-lock.json are copied
|
| 8 |
-
# where available (npm@5+)
|
| 9 |
COPY package*.json ./
|
|
|
|
| 10 |
|
| 11 |
-
|
| 12 |
-
# If you are building your code for production
|
| 13 |
-
# RUN npm ci --only=production
|
| 14 |
-
|
| 15 |
-
# Bundle app source
|
| 16 |
COPY . .
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Use a specific version of the node image
|
| 2 |
+
FROM node:16-alpine
|
| 3 |
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /code
|
| 6 |
|
| 7 |
+
# Copy package.json and package-lock.json and install dependencies
|
|
|
|
|
|
|
| 8 |
COPY package*.json ./
|
| 9 |
+
RUN npm install --production
|
| 10 |
|
| 11 |
+
# Copy the rest of the application files
|
|
|
|
|
|
|
|
|
|
|
|
|
| 12 |
COPY . .
|
| 13 |
|
| 14 |
+
# Create a directory for temporary files
|
| 15 |
+
RUN mkdir /code/temp
|
| 16 |
+
|
| 17 |
+
# Expose port
|
| 18 |
+
EXPOSE 7860
|
| 19 |
+
|
| 20 |
+
# Set user to non-root
|
| 21 |
+
USER node
|
| 22 |
+
|
| 23 |
+
# Start Node.js application
|
| 24 |
+
CMD ["node", "index.js"]
|