Spaces:
Running
Running
bradduy
commited on
Commit
·
66afcc2
1
Parent(s):
cad58f1
update readme
Browse files- Dockerfile +15 -7
Dockerfile
CHANGED
@@ -1,16 +1,24 @@
|
|
1 |
-
# Use an official Node.js
|
2 |
FROM node:20
|
3 |
|
4 |
-
#
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
|
8 |
-
|
9 |
-
# Install dependencies
|
10 |
RUN yarn install
|
11 |
|
12 |
-
#
|
13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
# Expose the port that Next.js will run on
|
16 |
EXPOSE 3000
|
|
|
1 |
+
# Use an official Node.js image
|
2 |
FROM node:20
|
3 |
|
4 |
+
# Create and set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Copy package.json and install dependencies
|
8 |
+
COPY package.json package-lock.json ./
|
|
|
9 |
RUN yarn install
|
10 |
|
11 |
+
# Add a non-root user (e.g., 'appuser')
|
12 |
+
RUN useradd -m appuser
|
13 |
+
|
14 |
+
# Give ownership of the app directory to the new user
|
15 |
+
RUN chown -R appuser /app
|
16 |
+
|
17 |
+
# Switch to the non-root user
|
18 |
+
USER appuser
|
19 |
+
|
20 |
+
# Copy the rest of the application code
|
21 |
+
COPY . .
|
22 |
|
23 |
# Expose the port that Next.js will run on
|
24 |
EXPOSE 3000
|