build: migrate CI and Docker setup to pnpm

This commit is contained in:
satnaing
2025-02-25 21:05:00 +07:00
committed by Sat Naing
parent f71fdc1398
commit cb9fd59f79
2 changed files with 22 additions and 12 deletions
+12 -7
View File
@@ -17,26 +17,31 @@ jobs:
strategy: strategy:
matrix: matrix:
node-version: [18.x] node-version: [20]
steps: steps:
- name: "☁️ Checkout repository" - name: "☁️ Checkout repository"
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: "🔧 Setup Node.js ${{ matrix.node-version }}" - name: "📦 Install pnpm"
uses: pnpm/action-setup@v4
with:
version: 10
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: "npm" cache: "pnpm"
- name: "📦 Install dependencies" - name: "📦 Install dependencies"
run: npm ci run: pnpm install
- name: "🔎 Lint code" - name: "🔎 Lint code"
run: npm run lint run: pnpm run lint
- name: "📝 Checking code format" - name: "📝 Checking code format"
run: npm run format:check run: pnpm run format:check
- name: "🚀 Build the project" - name: "🚀 Build the project"
run: npm run build run: pnpm run build
+10 -5
View File
@@ -1,12 +1,17 @@
# Base stage for building the static files # Base stage for building the static files
FROM node:lts AS base FROM node:lts AS base
WORKDIR /app WORKDIR /app
COPY package*.json ./
RUN npm install # Install pnpm
RUN corepack enable && corepack prepare pnpm@latest --activate
COPY package.json pnpm-lock.yaml ./
RUN pnpm install --frozen-lockfile
COPY . . COPY . .
RUN npm run build RUN pnpm run build
# Runtime stage for serving the application # Runtime stage for serving the application
FROM nginx:mainline-alpine-slim AS runtime FROM nginx:mainline-alpine-slim AS runtime
COPY --from=base ./app/dist /usr/share/nginx/html COPY --from=base /app/dist /usr/share/nginx/html
EXPOSE 80 EXPOSE 80