server
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use the official Node.js 18 image as the base
|
2 |
+
FROM node:18
|
3 |
+
|
4 |
+
# Create a new user and switch to it
|
5 |
+
RUN useradd -m -u 1000 user
|
6 |
+
USER user
|
7 |
+
|
8 |
+
# Set the working directory
|
9 |
+
WORKDIR /app
|
10 |
+
|
11 |
+
# Copy package.json and package-lock.json first (for efficient caching)
|
12 |
+
COPY --chown=user ./package.json ./package-lock.json ./
|
13 |
+
|
14 |
+
# Install dependencies (including dev dependencies)
|
15 |
+
RUN npm install --no-cache
|
16 |
+
|
17 |
+
# Copy the rest of the application files
|
18 |
+
COPY --chown=user . .
|
19 |
+
|
20 |
+
# Expose the port the app runs on
|
21 |
+
EXPOSE 3000
|
22 |
+
|
23 |
+
# Start the development server
|
24 |
+
CMD ["npm", "run", "dev"]
|