From 293f38b7e48c4729c58bd200afcc81451bbb19c8 Mon Sep 17 00:00:00 2001 From: Ardeman Date: Sat, 22 Feb 2025 12:03:32 +0800 Subject: [PATCH] chore: update Dockerfile and README for pnpm support and Node.js version --- Dockerfile | 24 ++++++++++++++---------- README.md | 53 ++++++++++++++++++++-------------------------------- package.json | 4 ++++ 3 files changed, 38 insertions(+), 43 deletions(-) diff --git a/Dockerfile b/Dockerfile index 207bf93..eabb397 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,22 +1,26 @@ -FROM node:20-alpine AS development-dependencies-env +FROM node:22.13.1-alpine AS development-dependencies-env +RUN npm install -g pnpm@9.15.4 COPY . /app WORKDIR /app -RUN npm ci +RUN pnpm install -FROM node:20-alpine AS production-dependencies-env -COPY ./package.json package-lock.json /app/ +FROM node:22.13.1-alpine AS production-dependencies-env +RUN npm install -g pnpm@9.15.4 +COPY ./package.json pnpm-lock.yaml /app/ WORKDIR /app -RUN npm ci --omit=dev +RUN pnpm install --prod -FROM node:20-alpine AS build-env +FROM node:22.13.1-alpine AS build-env +RUN npm install -g pnpm@9.15.4 COPY . /app/ COPY --from=development-dependencies-env /app/node_modules /app/node_modules WORKDIR /app -RUN npm run build +RUN pnpm build -FROM node:20-alpine -COPY ./package.json package-lock.json /app/ +FROM node:22.13.1-alpine +RUN npm install -g pnpm@9.15.4 +COPY ./package.json pnpm-lock.yaml /app/ COPY --from=production-dependencies-env /app/node_modules /app/node_modules COPY --from=build-env /app/build /app/build WORKDIR /app -CMD ["npm", "run", "start"] \ No newline at end of file +CMD ["pnpm", "start"] diff --git a/README.md b/README.md index e0d2066..bd4ca3b 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,26 @@ -# Welcome to React Router! - -A modern, production-ready template for building full-stack React applications using React Router. - -[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/remix-run/react-router-templates/tree/main/default) - -## Features - -- 🚀 Server-side rendering -- ⚡️ Hot Module Replacement (HMR) -- 📦 Asset bundling and optimization -- 🔄 Data loading and mutations -- 🔒 TypeScript by default -- 🎉 TailwindCSS for styling -- 📖 [React Router docs](https://reactrouter.com/) - ## Getting Started +### Prerequisite + +This project requires: + +- Node.js version 22.13.1 +- pnpm version 9.15.4 + +To install Node.js, visit [nodejs.org](https://nodejs.org/) + +To install pnpm, run: + +```bash +npm install -g pnpm@9.15.4 +``` + ### Installation Install the dependencies: ```bash -npm install +pnpm install ``` ### Development @@ -29,7 +28,7 @@ npm install Start the development server with HMR: ```bash -npm run dev +pnpm dev ``` Your application will be available at `http://localhost:5173`. @@ -39,31 +38,19 @@ Your application will be available at `http://localhost:5173`. Create a production build: ```bash -npm run build +pnpm build ``` ## Deployment ### Docker Deployment -This template includes three Dockerfiles optimized for different package managers: - -- `Dockerfile` - for npm -- `Dockerfile.pnpm` - for pnpm -- `Dockerfile.bun` - for bun - To build and run using Docker: ```bash -# For npm +# Build the docker docker build -t my-app . -# For pnpm -docker build -f Dockerfile.pnpm -t my-app . - -# For bun -docker build -f Dockerfile.bun -t my-app . - # Run the container docker run -p 3000:3000 my-app ``` @@ -81,7 +68,7 @@ The containerized application can be deployed to any platform that supports Dock If you're familiar with deploying Node applications, the built-in app server is production-ready. -Make sure to deploy the output of `npm run build` +Make sure to deploy the output of `pnpm build` ``` ├── package.json diff --git a/package.json b/package.json index 4aafede..99d8da8 100644 --- a/package.json +++ b/package.json @@ -55,5 +55,9 @@ "typescript-eslint": "^8.22.0", "vite": "^5.4.11", "vite-tsconfig-paths": "^5.1.4" + }, + "engines": { + "node": ">22.13.1", + "pnpm": ">9.15.4" } }