Skip to content
Open
Show file tree
Hide file tree
Changes from 10 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
33 changes: 29 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
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
Comment on lines +3 to +5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

書くなら package.json かな。

Comment on lines +3 to +5

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

この指摘は妥当そう。

修正はこのレビューをコミットするか、

ENV PNPM_STORE_DIR=/app/.pnpm-store

を追加しておくのがよさそうです。

BuildKit の --mount=type=cache を使う場合は、この設定は不要なこともあるらしい…?


WORKDIR /app
COPY package.json pnpm-lock.yaml ./

FROM base AS development
RUN pnpm install --frozen-lockfile
COPY . .
CMD ["npm", "run", "dev"]

CMD ["pnpm", "run", "dev"]

FROM base AS builder
RUN pnpm install --frozen-lockfile
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.

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
Loading