Skip to content

Commit 71db5ef

Browse files
committed
chore: update Dockerfile and CI workflows to use pnpm for dependency management and build process
1 parent ca00ab0 commit 71db5ef

4 files changed

Lines changed: 93 additions & 31 deletions

File tree

.github/workflows/ci.yml

Lines changed: 30 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,11 @@ on:
88

99
jobs:
1010
lint:
11-
name: Lint and Validate
12-
runs-on: ubuntu-latest
11+
name: Lint and Validate (${{ matrix.os }})
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
1316

1417
steps:
1518
- name: Checkout code
@@ -19,38 +22,40 @@ jobs:
1922
uses: actions/setup-node@v4
2023
with:
2124
node-version: "22"
22-
cache: "npm"
25+
26+
- uses: pnpm/action-setup@v4
27+
name: Install pnpm
28+
id: pnpm-install
29+
with:
30+
version: 7
31+
run_install: false
32+
33+
- name: Get pnpm store directory
34+
id: pnpm-cache
35+
shell: bash
36+
run: |
37+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
38+
39+
- uses: actions/cache@v5
40+
name: Setup pnpm cache
41+
with:
42+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
43+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
44+
restore-keys: |
45+
${{ runner.os }}-pnpm-store-
2346
2447
- name: Install dependencies
25-
run: npm ci
48+
run: pnpm install --frozen-lockfile
2649

2750
- name: Run oxlint and TypeScript checks
28-
run: npm run lint
51+
run: pnpm run lint
2952

3053
- name: Validate Docker Compose file
54+
if: matrix.os == 'ubuntu-latest'
3155
run: docker compose -f docker-compose.yaml config --quiet
3256

3357
- name: Lint Dockerfile with Hadolint
34-
uses: hadolint/hadolint-action@v3.1.0
35-
with:
36-
dockerfile: Dockerfile
37-
failure-threshold: error
38-
39-
docker-validation:
40-
name: Docker Validation
41-
runs-on: ubuntu-latest
42-
43-
steps:
44-
- name: Checkout code
45-
uses: actions/checkout@v4
46-
47-
- name: Validate docker-compose.yaml
48-
run: |
49-
echo "Validating docker-compose.yaml with Docker Compose..."
50-
docker compose -f docker-compose.yaml config --quiet
51-
echo "✓ docker-compose.yaml is valid"
52-
53-
- name: Lint Dockerfile
58+
if: matrix.os == 'ubuntu-latest'
5459
uses: hadolint/hadolint-action@v3.1.0
5560
with:
5661
dockerfile: Dockerfile

.github/workflows/pages-build-site.yml

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,52 @@ concurrency:
1515
cancel-in-progress: false
1616

1717
jobs:
18+
build:
19+
name: Build (${{ matrix.os }})
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
matrix:
23+
os: [ubuntu-latest, windows-latest, macos-latest]
24+
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v6
28+
29+
- name: Install Node.js
30+
uses: actions/setup-node@v6
31+
with:
32+
node-version: "22"
33+
34+
- uses: pnpm/action-setup@v4
35+
name: Install pnpm
36+
id: pnpm-install
37+
with:
38+
version: 7
39+
run_install: false
40+
41+
- name: Get pnpm store directory
42+
id: pnpm-cache
43+
shell: bash
44+
run: |
45+
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
46+
47+
- uses: actions/cache@v5
48+
name: Setup pnpm cache
49+
with:
50+
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
51+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pnpm-store-
54+
55+
- name: Install dependencies
56+
run: pnpm install --frozen-lockfile
57+
58+
- name: Build
59+
run: pnpm build
60+
1861
deploy:
62+
name: Deploy to GitHub Pages
63+
needs: build
1964
environment:
2065
name: github-pages
2166
url: ${{ steps.deployment.outputs.page_url }}
@@ -27,7 +72,7 @@ jobs:
2772
- name: Install Node.js
2873
uses: actions/setup-node@v6
2974
with:
30-
node-version: 23
75+
node-version: "22"
3176

3277
- uses: pnpm/action-setup@v4
3378
name: Install pnpm
@@ -51,7 +96,7 @@ jobs:
5196
${{ runner.os }}-pnpm-store-
5297
5398
- name: Install dependencies
54-
run: pnpm install
99+
run: pnpm install --frozen-lockfile
55100

56101
- name: Build
57102
run: pnpm build

Dockerfile

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,22 @@
11
ARG NODE_VERSION=22
22
FROM node:${NODE_VERSION} AS builder
33
WORKDIR /app
4-
COPY package*.json ./ /app/
5-
RUN npm install
4+
5+
# Install pnpm (Node.js image includes npm, so this is reliable)
6+
RUN npm install -g pnpm && \
7+
pnpm --version
8+
9+
# Copy package files
10+
COPY package.json pnpm-lock.yaml ./
11+
12+
# Install dependencies
13+
RUN pnpm install --frozen-lockfile
14+
15+
# Copy source code
616
COPY . .
7-
RUN npm run build
17+
18+
# Build
19+
RUN pnpm run build
820

921
#FROM nginxinc/nginx-unprivileged:stable-alpine
1022
#COPY --from=builder /app/dist /usr/share/nginx/html

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"format": "prettier --write .",
1313
"lint:ts": "oxlint && tsc --noEmit",
1414
"lint:docker": "docker compose -f docker-compose.yaml config --quiet",
15-
"lint": "npm run lint:ts && npm run lint:docker"
15+
"lint": "pnpm run lint:ts && pnpm run lint:docker"
1616
},
1717
"engines": {
1818
"node": ">=20.19.0"

0 commit comments

Comments
 (0)