Update Dockerfile
Browse files- Dockerfile +6 -6
Dockerfile
CHANGED
@@ -5,16 +5,16 @@ FROM node:14 AS build
|
|
5 |
WORKDIR /usr/src/app
|
6 |
|
7 |
# Copy package.json and package-lock.json for installing dependencies
|
8 |
-
COPY package.json
|
9 |
|
10 |
# Install dependencies
|
11 |
-
RUN
|
12 |
|
13 |
# Copy the entire project
|
14 |
COPY . .
|
15 |
|
16 |
# Build the project
|
17 |
-
RUN
|
18 |
|
19 |
# Use a smaller image for the production environment
|
20 |
FROM node:14-alpine
|
@@ -28,13 +28,13 @@ WORKDIR /usr/src/app
|
|
28 |
# Copy from the "build" stage
|
29 |
COPY --from=build /usr/src/app/.next ./.next
|
30 |
COPY --from=build /usr/src/app/package.json ./package.json
|
31 |
-
COPY --from=build /usr/src/app/
|
32 |
|
33 |
# Install only production dependencies
|
34 |
-
RUN
|
35 |
|
36 |
# Expose the port the app will run on
|
37 |
EXPOSE 3000
|
38 |
|
39 |
# Command to run the application
|
40 |
-
CMD ["
|
|
|
5 |
WORKDIR /usr/src/app
|
6 |
|
7 |
# Copy package.json and package-lock.json for installing dependencies
|
8 |
+
COPY package.json package-lock.json ./
|
9 |
|
10 |
# Install dependencies
|
11 |
+
RUN npm install
|
12 |
|
13 |
# Copy the entire project
|
14 |
COPY . .
|
15 |
|
16 |
# Build the project
|
17 |
+
RUN npm run build
|
18 |
|
19 |
# Use a smaller image for the production environment
|
20 |
FROM node:14-alpine
|
|
|
28 |
# Copy from the "build" stage
|
29 |
COPY --from=build /usr/src/app/.next ./.next
|
30 |
COPY --from=build /usr/src/app/package.json ./package.json
|
31 |
+
COPY --from=build /usr/src/app/package-lock.json ./package-lock.json
|
32 |
|
33 |
# Install only production dependencies
|
34 |
+
RUN npm install --production
|
35 |
|
36 |
# Expose the port the app will run on
|
37 |
EXPOSE 3000
|
38 |
|
39 |
# Command to run the application
|
40 |
+
CMD ["npm", "start"]
|