Spaces:
Sleeping
Sleeping
bradduy
commited on
Commit
·
ae01397
1
Parent(s):
7ec743e
update dockerfile
Browse files- Dockerfile +7 -10
Dockerfile
CHANGED
@@ -4,11 +4,11 @@ FROM node:20
|
|
4 |
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
-
# Copy package.json and
|
8 |
-
COPY package.json
|
9 |
|
10 |
-
# Install dependencies using
|
11 |
-
RUN
|
12 |
|
13 |
# Create a non-root user and set permissions
|
14 |
RUN useradd -m appuser
|
@@ -19,17 +19,14 @@ RUN chown -R appuser /app
|
|
19 |
# Switch to the non-root user
|
20 |
USER appuser
|
21 |
|
22 |
-
# Copy the rest of
|
23 |
COPY . .
|
24 |
|
25 |
-
# Create the .next directory (this can sometimes be needed to ensure build process has the right permissions)
|
26 |
-
RUN mkdir -p /app/.next && chown -R appuser /app/.next
|
27 |
-
|
28 |
# Build the Next.js app
|
29 |
-
RUN
|
30 |
|
31 |
# Expose the port the app will run on
|
32 |
EXPOSE 3000
|
33 |
|
34 |
# Start the Next.js app
|
35 |
-
CMD ["
|
|
|
4 |
# Set the working directory
|
5 |
WORKDIR /app
|
6 |
|
7 |
+
# Copy package.json and package-lock.json into the container
|
8 |
+
COPY package.json package-lock.json ./
|
9 |
|
10 |
+
# Install dependencies using npm (use --legacy-peer-deps if you face dependency issues)
|
11 |
+
RUN npm install --legacy-peer-deps --unsafe-perm=true
|
12 |
|
13 |
# Create a non-root user and set permissions
|
14 |
RUN useradd -m appuser
|
|
|
19 |
# Switch to the non-root user
|
20 |
USER appuser
|
21 |
|
22 |
+
# Copy the rest of your application code into the container
|
23 |
COPY . .
|
24 |
|
|
|
|
|
|
|
25 |
# Build the Next.js app
|
26 |
+
RUN npm run build
|
27 |
|
28 |
# Expose the port the app will run on
|
29 |
EXPOSE 3000
|
30 |
|
31 |
# Start the Next.js app
|
32 |
+
CMD ["npm", "start"]
|