Switch to pnpm
All checks were successful
Build and Push Docker Image / docker (push) Successful in 2m22s
All checks were successful
Build and Push Docker Image / docker (push) Successful in 2m22s
This commit is contained in:
44
Dockerfile
44
Dockerfile
@@ -1,35 +1,19 @@
|
||||
# Step 1: Set the base image to Node.js
|
||||
FROM node:18-alpine AS build
|
||||
|
||||
# Step 2: Set the working directory inside the container
|
||||
FROM node:22-slim AS base
|
||||
ENV PNPM_HOME="/pnpm"
|
||||
ENV PATH="$PNPM_HOME:$PATH"
|
||||
RUN corepack enable
|
||||
COPY . /app
|
||||
WORKDIR /app
|
||||
|
||||
# Step 3: Copy the package.json and package-lock.json (or yarn.lock) for dependency installation
|
||||
COPY package.json package-lock.json ./
|
||||
FROM base AS prod-deps
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
|
||||
|
||||
# Step 4: Install dependencies
|
||||
RUN npm install
|
||||
FROM base AS build
|
||||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
|
||||
RUN pnpm run build
|
||||
|
||||
# Step 5: Copy the rest of the project files into the container
|
||||
COPY . .
|
||||
|
||||
# Step 6: Build the Next.js app
|
||||
RUN npm run build
|
||||
|
||||
# Step 7: Create the final image (production stage)
|
||||
FROM node:18-alpine
|
||||
|
||||
# Set the working directory inside the container for production
|
||||
WORKDIR /app
|
||||
|
||||
# Copy the necessary files from the build stage
|
||||
COPY --from=build /app ./
|
||||
|
||||
# Step 8: Install production dependencies only (optional)
|
||||
RUN npm install --production
|
||||
|
||||
# Step 9: Expose the default Next.js port
|
||||
FROM base
|
||||
COPY --from=prod-deps /app/node_modules /app/node_modules
|
||||
COPY --from=build /app/.next /app/.next
|
||||
EXPOSE 3000
|
||||
|
||||
# Step 10: Set the command to run the Next.js app
|
||||
CMD ["npm", "start"]
|
||||
CMD [ "pnpm", "start" ]
|
||||
5854
package-lock.json
generated
5854
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
"dev": "next dev --turbopack",
|
||||
"build": "next build",
|
||||
"start": "next start",
|
||||
@@ -24,5 +25,5 @@
|
||||
"eslint-config-next": "15.1.3",
|
||||
"@eslint/eslintrc": "^3"
|
||||
},
|
||||
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
|
||||
"packageManager": "pnpm@9.15.2+sha512.93e57b0126f0df74ce6bff29680394c0ba54ec47246b9cf321f0121d8d9bb03f750a705f24edc3c1180853afd7c2c3b94196d0a3d53d3e069d9e2793ef11f321"
|
||||
}
|
||||
|
||||
3539
pnpm-lock.yaml
generated
Normal file
3539
pnpm-lock.yaml
generated
Normal file
File diff suppressed because it is too large
Load Diff
7
pnpm-workspace.yaml
Normal file
7
pnpm-workspace.yaml
Normal file
@@ -0,0 +1,7 @@
|
||||
packages:
|
||||
# include packages in subfolders (e.g. apps/ and packages/)
|
||||
- "apps/**"
|
||||
- 'packages/**'
|
||||
# if required, exclude some directories
|
||||
- '!**/test/**'
|
||||
|
||||
Reference in New Issue
Block a user