Skip to content

add docker volume for pnpm-store #476

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 28, 2023
Merged
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
16 changes: 13 additions & 3 deletions compose/dev/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ services:
- db
volumes:
- ../..:/codepod
# Need to pnpm config set store-dir ~/pnpm
# Ref: https://github.com/pnpm/pnpm/issues/3952#issuecomment-1262136483
command: sh -c "corepack enable && pnpm config set store-dir ~/pnpm && pnpm install && cd apps/api && pnpm dlx prisma migrate dev"
# pnpm-store serves two purposes:
# 1. without it, pnpm install will throw error. Ref:
# https://github.com/pnpm/pnpm/issues/3952#issuecomment-1262136483
# 2. it is mounted to all service containers, and will cache and speed up
# pnpm install and pnpm add/remove
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm install && cd apps/api && pnpm dlx prisma migrate dev"
environment:
DATABASE_URL: "postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@db:5432/${POSTGRES_DB}?schema=public"

Expand All @@ -42,6 +46,7 @@ services:
working_dir: /codepod/apps/api
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
- /var/run/docker.sock:/var/run/docker.sock
command: sh -c "corepack enable && pnpm dev"
environment:
Expand Down Expand Up @@ -75,6 +80,7 @@ services:
working_dir: /codepod/apps/api
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
- /var/run/docker.sock:/var/run/docker.sock
command: sh -c "corepack enable && pnpm dev:yjs"
environment:
Expand Down Expand Up @@ -108,13 +114,15 @@ services:
VITE_APP_CODEIUM_API_KEY: ${CODEIUM_API_KEY}
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm generate && pnpm dev"

proxy:
image: node:18
working_dir: /codepod/apps/proxy
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"

nginx:
Expand All @@ -134,6 +142,7 @@ services:
working_dir: /codepod/apps/runtime
volumes:
- ../..:/codepod
- pnpm-store:/codepod/.pnpm-store
command: sh -c "corepack enable && pnpm dev"

example-runtime-prod:
Expand All @@ -146,6 +155,7 @@ services:

volumes:
db-data:
pnpm-store:

networks:
default:
Expand Down