Skip to content

Commit

Permalink
chore: migrate to pnpm
Browse files Browse the repository at this point in the history
  • Loading branch information
samaratungajs committed Dec 30, 2024
1 parent edaf2c7 commit b6670f7
Show file tree
Hide file tree
Showing 8 changed files with 9,872 additions and 25,945 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: "20"
cache: ${{ steps.detect-package-manager.outputs.manager }}
- name: Install dependencies
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
Expand Down
1 change: 1 addition & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
shamefully-hoist=true
40 changes: 18 additions & 22 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
FROM node:16-alpine as development
FROM node:20-alpine AS base

# Create app directory
WORKDIR /usr/src/app
ENV HUSKY=0
ENV PNPM_HOME="/pnpm"
ENV PATH="$PNPM_HOME:$PATH"
RUN corepack enable

# Install app dependencies
# A wildcard is used to ensure both package.json AND package-lock.json are copied
# where available (npm@5+)
COPY package*.json ./

RUN npm install

# Bundle app source
COPY . .

RUN npm run build

FROM node:16-alpine as production
WORKDIR /usr/src/app

COPY package*.json ./
RUN npm install --only=production
FROM base AS build
WORKDIR /app
COPY .npmrc pnpm-lock.yaml package.json ./
RUN --mount=type=secret,id=npmrc,target=/root/.npmrc pnpm install --frozen-lockfile
COPY . .
RUN pnpm build

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

CMD [ "npm", "run" , "start:prod" ]
EXPOSE 3000
CMD ["pnpm", "start:prod"]
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ Please go through [Nest Docs](https://docs.nestjs.com/) before playing with the
To run the application you need to have **PostgreSQL** installed.

```bash
$ npm install
$ pnpm install
```

### Running the app

```bash
# development
$ npm run start
$ pnpm run start

# watch mode
$ npm run start:dev

# debug mode
$ npm run start:debug
$ pnpm run start:debug

# production mode
$ npm run start:prod
$ pnpm run start:prod
```

### Running the app with docker :whale:
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ services:
api:
build:
context: .
target: development
target: build
environment:
- DATABASE_URL=postgres://admin:admin@db/wavezync
- DATABASE_URL=postgres://postgres:postgres@db/wavezync
- PORT=3000
ports:
- 3000:3000
Expand Down
Loading

0 comments on commit b6670f7

Please sign in to comment.