Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.git
.github

Dockerfile
.dockerignore

node_modules/
.pnpm-store/

build/
dist/
.next/
out/

*.log

.env
.env.*

.DS_Store
2 changes: 0 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
- uses: actions/checkout@v4

- uses: pnpm/action-setup@v6
with:
version: 10

- uses: actions/setup-node@v4
with:
Expand Down
34 changes: 30 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,33 @@
FROM node:24
FROM node:24 AS base

COPY package*.json ./
RUN npm install
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack install

FROM base AS deps
RUN pnpm install --frozen-lockfile

FROM deps AS development
COPY . .
CMD ["npm", "run", "dev"]
CMD ["pnpm", "dev"]
Comment on lines +14 to +16

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Dependency directory configuration:"
rg -n --hidden -g 'Dockerfile' -g 'docker-compose.yml' -g '.npmrc' \
  'node_module|node_modules|modules-dir|virtual-store-dir' . || true

echo "Development target mounts:"
rg -n -A8 -B3 \
  'target: development|volumes:|node_module|node_modules' \
  docker-compose.yml

Repository: sf-kosen/Nanase-Bot

Length of output: 452


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Tracked manifest-related files:"
git ls-files | rg '(^|/)(Dockerfile|docker-compose\.ya?ml|package\.json|pnpm-workspace\.yaml|\.npmrc|pnpm-lock\.yaml)$' || true

echo
echo "Dockerfile:"
cat -n Dockerfile

echo
echo "docker-compose.yml:"
cat -n docker-compose.yml

echo
echo "package.json deps/scripts:"
python3 - <<'PY'
import json
from pathlib import Path
p=Path('package.json')
if p.exists():
    data=json.loads(p.read_text())
    for key in ('scripts','dependencies','devDependencies','packageManager'):
        print(key, data.get(key))
PY

echo
echo "pnpm config references:"
rg -n --hidden -g 'Dockerfile' -g 'docker-compose.yml' -g 'package.json' -g '.npmrc' \
  'modules-dir|virtual-store-dir|node_module|node_modules|packageManager|pnpm' . || true

Repository: sf-kosen/Nanase-Bot

Length of output: 2384


🌐 Web query:

pnpm default modules-dir node_modules virtual-store-dir pnpm 11 documentation

💡 Result:

In pnpm v11, the configuration for directory locations is managed primarily through the pnpm-workspace.yaml file or global configuration, as pnpm no longer reads settings from the pnpm field in package.json [1][2][3]. The default settings for these directories are: modules-dir Default: node_modules [4] This is the directory where pnpm installs your project's dependencies [4]. virtual-store-dir Default: node_modules/.pnpm [4] This directory acts as the virtual store containing links to the central package store [4]. It is where all direct and indirect dependencies are linked [4]. Configuration These settings can be configured in your project's pnpm-workspace.yaml file or via global configuration (config.yaml) [1][3]. For example: modulesDir: node_modules virtualStoreDir:.pnpm Note that while the default virtual-store-dir is node_modules/.pnpm, setting it to a relative path like.pnpm can help create cleaner stack traces, as the dependency paths will appear one directory higher [4][5]. Customizing the virtual-store-dir is also a common method for resolving long path issues on Windows by placing the store in the root of a drive [4][5]. Every project must have its own virtual store; it cannot be shared between multiple projects, except within a workspace where the root is shared [4].

Citations:


Align the dependency volume with pnpm’s module directory.

docker-compose.yml mounts /app/node_module, but pnpm installs dependencies into /app/node_modules by default, and this project does not configure modules-dir. The development bind mount exposes the working tree, so that volume would leave the installed dependencies unreadable; mount /app/node_modules unless a custom dependency directory is deliberately set.

Proposed compose volume change
-      - /app/node_module
+      - /app/node_modules
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@Dockerfile` around lines 14 - 16, Update the development dependency volume
configuration used with the Dockerfile’s development target and docker-compose
setup to mount /app/node_modules, matching pnpm’s default installation
directory. Do not introduce a custom modules-dir setting; preserve the existing
development bind mount and other volumes.


FROM deps AS builder
COPY . .
RUN pnpm run build

FROM base AS production
ENV NODE_ENV=production

RUN pnpm install --frozen-lockfile --prod
Comment thread
sora81dev marked this conversation as resolved.

# NOTE: 書き込みが発生するなら変更する必要がある
COPY --from=builder /app/build ./build

USER node
EXPOSE 3000

CMD ["node", "./build/index.js"]
7 changes: 6 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,10 @@ services:
stdin_open: true
tty: true
build:
dockerfile: ./Dockerfile
context: .
dockerfile: ./Dockerfile
target: development
volumes:
- .:/app
- /app/node_module
- /app/.pnpm-store
Comment thread
sora81dev marked this conversation as resolved.
Comment on lines +10 to +13
63 changes: 32 additions & 31 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,34 @@
{
"name": "nanase-bot",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"main": "src/index.ts",
"scripts": {
"dev": "ts-node src/index.ts",
"build": "tsc",
"start": "node -r tsconfig-paths/register ./build/index.js",
"// linters //": "",
"typecheck": "tsc --noEmit",
"lint": "biome lint .",
"format": "biome format . --write",
"check": "biome check .",
"fix": "biome check . --write"
},
"devDependencies": {
"@biomejs/biome": "2.5.3",
"@types/node": "^25.0.3",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.9.3"
},
"dependencies": {
"discord.js": "^14.26.5",
"dotenv": "^17.2.3"
},
"overrides": {
"axios": "1.16.0"
}
"name": "nanase-bot",
"version": "1.0.0",
"description": "",
"license": "ISC",
"author": "",
"main": "src/index.ts",
"packageManager": "pnpm@11.9.0",
"scripts": {
"dev": "ts-node src/index.ts",
"build": "tsc",
"start": "node -r tsconfig-paths/register ./build/index.js",
"// linters //": "",
"typecheck": "tsc --noEmit",
"lint": "biome lint .",
"format": "biome format . --write",
"check": "biome check .",
"fix": "biome check . --write"
},
"devDependencies": {
"@biomejs/biome": "2.5.3",
"@types/node": "^25.0.3",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.9.3"
},
"dependencies": {
"discord.js": "^14.26.5",
"dotenv": "^17.2.3"
},
"overrides": {
"axios": "1.16.0"
}
}
Loading