-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: ♻️ testing dockerfile update
- Loading branch information
Showing
1 changed file
with
22 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" ] |