diff --git a/bot/Dockerfile b/bot/Dockerfile index bb1a3aaa..4fb0b537 100644 --- a/bot/Dockerfile +++ b/bot/Dockerfile @@ -1,8 +1,26 @@ +# Start from a slim Node.js base image FROM node:20-slim + +# Set the working directory inside the container WORKDIR /usr/src/app -COPY package.json package-lock.json ./ -RUN npm ci --production -RUN npm cache clean --force + +# Install pnpm globally +RUN npm install -g pnpm + +# Copy package.json and pnpm-lock.yaml (or pnpmfile.js if using custom pnpm configuration) +COPY package.json pnpm-lock.yaml* ./ + +# Install dependencies with pnpm +RUN pnpm install --production + +# Clean up pnpm store to reduce image size +RUN pnpm store prune --production + +# Set environment variable for Node.js environment ENV NODE_ENV="production" + +# Copy the entire project files into the working directory COPY . . -CMD [ "npm", "start" ] + +# Specify the command to run your application +CMD [ "pnpm", "start" ]