chore: configure pnpm store location in Dockerfile and docker-compose for improved dependency management

This commit is contained in:
Julien Froidefond
2025-10-15 03:35:54 +02:00
parent d1993f4bc2
commit 2be1ff05cd
2 changed files with 10 additions and 2 deletions

View File

@@ -8,6 +8,9 @@ ENV MONGODB_URI=$MONGODB_URI
# Set working directory
WORKDIR /app
# Configure pnpm store location
ENV PNPM_HOME="/app/.pnpm-store"
# Install dependencies for node-gyp
RUN apk add --no-cache python3 make g++
@@ -22,7 +25,8 @@ COPY tsconfig.json .eslintrc.json ./
COPY tailwind.config.ts postcss.config.js ./
# Install dependencies with pnpm
RUN pnpm install --frozen-lockfile
RUN pnpm config set store-dir /app/.pnpm-store && \
pnpm install --frozen-lockfile
# Copy source files
COPY src ./src
@@ -40,6 +44,7 @@ WORKDIR /app
COPY package.json pnpm-lock.yaml ./
RUN corepack enable && \
corepack prepare pnpm@9.0.0 --activate && \
pnpm config set store-dir /app/.pnpm-store && \
pnpm install --prod --frozen-lockfile && \
pnpm store prune

View File

@@ -14,12 +14,14 @@ services:
- .:/app
- /app/node_modules
- /app/.next
- pnpm_store:/app/.pnpm-store
environment:
- NODE_ENV=development
- MONGO_USER=admin
- MONGO_PASSWORD=password123
- MONGODB_URI=mongodb://admin:password123@mongodb:27017/stripstream?authSource=admin
command: npm run dev
- PNPM_HOME=/app/.pnpm-store
command: sh -c "pnpm config set store-dir /app/.pnpm-store && pnpm install && pnpm dev"
mongodb:
image: mongo:latest
@@ -37,3 +39,4 @@ services:
volumes:
mongodb_data:
pnpm_store: