Skip to content

Commit b6670f7

Browse files
committed
chore: migrate to pnpm
1 parent edaf2c7 commit b6670f7

File tree

8 files changed

+9872
-25945
lines changed

8 files changed

+9872
-25945
lines changed

.github/workflows/build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ jobs:
4949
- name: Setup Node
5050
uses: actions/setup-node@v3
5151
with:
52-
node-version: "16"
52+
node-version: "20"
5353
cache: ${{ steps.detect-package-manager.outputs.manager }}
5454
- name: Install dependencies
5555
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}

.npmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
shamefully-hoist=true

Dockerfile

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,23 @@
1-
FROM node:16-alpine as development
1+
FROM node:20-alpine AS base
22

3-
# Create app directory
4-
WORKDIR /usr/src/app
3+
ENV HUSKY=0
4+
ENV PNPM_HOME="/pnpm"
5+
ENV PATH="$PNPM_HOME:$PATH"
6+
RUN corepack enable
57

6-
# Install app dependencies
7-
# A wildcard is used to ensure both package.json AND package-lock.json are copied
8-
# where available (npm@5+)
9-
COPY package*.json ./
10-
11-
RUN npm install
12-
13-
# Bundle app source
14-
COPY . .
15-
16-
RUN npm run build
17-
18-
FROM node:16-alpine as production
19-
WORKDIR /usr/src/app
20-
21-
COPY package*.json ./
22-
RUN npm install --only=production
8+
FROM base AS build
9+
WORKDIR /app
10+
COPY .npmrc pnpm-lock.yaml package.json ./
11+
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc pnpm install --frozen-lockfile
2312
COPY . .
13+
RUN pnpm build
2414

25-
COPY --from=development /usr/src/app/dist ./dist
15+
FROM base AS prod
16+
WORKDIR /app
17+
ENV NODE_ENV=production
18+
COPY .npmrc pnpm-lock.yaml package.json Procfile nest-cli.json ./
19+
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc pnpm install --frozen-lockfile --prod
20+
COPY --from=build /app/dist ./dist
2621

27-
CMD [ "npm", "run" , "start:prod" ]
22+
EXPOSE 3000
23+
CMD ["pnpm", "start:prod"]

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,23 @@ Please go through [Nest Docs](https://docs.nestjs.com/) before playing with the
1313
To run the application you need to have **PostgreSQL** installed.
1414

1515
```bash
16-
$ npm install
16+
$ pnpm install
1717
```
1818

1919
### Running the app
2020

2121
```bash
2222
# development
23-
$ npm run start
23+
$ pnpm run start
2424

2525
# watch mode
2626
$ npm run start:dev
2727

2828
# debug mode
29-
$ npm run start:debug
29+
$ pnpm run start:debug
3030

3131
# production mode
32-
$ npm run start:prod
32+
$ pnpm run start:prod
3333
```
3434

3535
### Running the app with docker :whale:

docker-compose.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ services:
33
api:
44
build:
55
context: .
6-
target: development
6+
target: build
77
environment:
8-
- DATABASE_URL=postgres://admin:admin@db/wavezync
8+
- DATABASE_URL=postgres://postgres:postgres@db/wavezync
99
- PORT=3000
1010
ports:
1111
- 3000:3000

0 commit comments

Comments
 (0)