Skip to content

Commit

Permalink
Mount cache in Docker image (safe-global#522)
Browse files Browse the repository at this point in the history
* Mount cache in Docker image

* Revert yarn update

* Add @types/lodash as prod dependency

* Update README to include Linter and Style Guide section

* Mount cache in Docker image

* Revert yarn update

* Add @types/lodash as prod dependency
  • Loading branch information
hectorgomezv authored Jul 3, 2023
1 parent 98d8855 commit 2808215
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 9 deletions.
28 changes: 28 additions & 0 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
nodeLinker: node-modules

plugins:
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
spec: '@yarnpkg/plugin-workspace-tools'

yarnPath: .yarn/releases/yarn-3.4.1.cjs
8 changes: 4 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
# BUILD CONTAINER
#
FROM node:18.16 as base
USER node
ENV NODE_ENV production
WORKDIR /app
COPY --chown=node:node package.json yarn.lock .yarnrc.yml tsconfig*.json ./
COPY --chown=node:node .yarn/releases ./.yarn/releases
RUN yarn install --immutable
COPY --chown=node:node . .
COPY --chown=node:node .yarn/plugins ./.yarn/plugins
COPY --chown=node:node package.json yarn.lock .yarnrc.yml tsconfig*.json ./
RUN --mount=type=cache,target=/root/.yarn YARN_CACHE_FOLDER=/root/.yarn yarn workspaces focus --production
COPY --chown=node:node src ./src
RUN yarn run build

#
Expand Down
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
[![Coverage Status](https://coveralls.io/repos/github/5afe/safe-client-gateway-nest/badge.svg?branch=main)](https://coveralls.io/github/5afe/safe-client-gateway-nest?branch=main)

## Requirements

- Node 18.16.0 – https://nodejs.org/en/
- Docker Compose – https://docs.docker.com/compose/

Expand Down Expand Up @@ -45,3 +46,15 @@ yarn run test:e2e
# test coverage
yarn run test:cov
```

## Linter and Style Guide

We use [ESLint](https://eslint.org/) as a linter and [Prettier](https://prettier.io/) as a code formatter.
You can run `yarn run lint` to execute ESLint and `yarn run format` to execute Prettier.

These checks can be automatically executed using Git hooks. If you wish to install the provided git hooks:

```shell
yarn install
yarn husky install
```
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,17 @@
"test:e2e": "jest --config ./test/jest-e2e.json --runInBand",
"test:e2e:cov": "jest --coverage --config ./test/jest-e2e.json --runInBand",
"test:all": "jest --config ./test/jest-all.json --runInBand",
"test:all:cov": "jest --coverage --config ./test/jest-all.json --runInBand",
"postinstall": "husky install"
"test:all:cov": "jest --coverage --config ./test/jest-all.json --runInBand"
},
"dependencies": {
"@nestjs/cli": "^10.0.5",
"@nestjs/common": "^10.0.3",
"@nestjs/config": "^3.0.0",
"@nestjs/core": "^10.0.3",
"@nestjs/platform-express": "^10.0.3",
"@nestjs/swagger": "^7.0.7",
"@node-redis/json": "^1.0.2",
"@types/lodash": "^4.14.195",
"ajv": "^8.12.0",
"ajv-formats": "^2.1.1",
"axios": "^1.4.0",
Expand All @@ -45,12 +46,10 @@
},
"devDependencies": {
"@faker-js/faker": "^8.0.2",
"@nestjs/cli": "^10.0.5",
"@nestjs/schematics": "^10.0.1",
"@nestjs/testing": "^10.0.3",
"@types/express": "^4.17.17",
"@types/jest": "29.5.2",
"@types/lodash": "^4.14.195",
"@types/node": "^20.3.2",
"@types/semver": "^7.5.0",
"@types/supertest": "^2.0.11",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"extends": "./tsconfig.json",
"exclude": ["node_modules", "test", "dist", "**/*spec.ts"]
"exclude": ["node_modules", "test", "dist", "**/*spec.ts", "**/__tests__/*"]
}

0 comments on commit 2808215

Please sign in to comment.