Skip to content

Commit b3cf3be

Browse files
authored
Upgrade libs, Fix Dockerfiles & Github actions (#12)
* upgrade next & react dependencies * upgrade devDependencies for react-client * upgrade devDependencies for next-client * upgrade express-server * upgrade nestjs-server dependencies * upgrade nish1896-eslint * run linting * upgrade prettier, lint-staged, husky * add favicon * fix favicon issue * update readme & dockerfiles * update react-client dockerfiles * add note in webvitals * update github action for docker * update github actions * update turbo cache false for build * update github actions versions
1 parent 081bd76 commit b3cf3be

File tree

22 files changed

+1851
-1936
lines changed

22 files changed

+1851
-1936
lines changed

.github/workflows/docker-img.yml

Lines changed: 43 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,53 @@
1-
# name: ci
1+
name: publish-docker-images
22

3-
# on:
4-
# push:
5-
# branches:
6-
# - 'main'
3+
on:
4+
push:
5+
branches:
6+
- 'main'
77

8-
# jobs:
9-
# docker:
10-
# runs-on: ubuntu-latest
11-
# steps:
12-
# - name: Check out code
13-
# uses: actions/checkout@v2
8+
jobs:
9+
docker:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: Check out code
13+
uses: actions/checkout@v4
1414

15-
# - name: Set up QEMU
16-
# uses: docker/setup-qemu-action@v2
15+
- name: Set up QEMU
16+
uses: docker/setup-qemu-action@v3
1717

18-
# - name: Set up Docker Buildx
19-
# uses: docker/setup-buildx-action@v2
18+
- name: Set up Docker Buildx
19+
uses: docker/setup-buildx-action@v3
2020

21-
# - name: Get current date
22-
# id: date
23-
# run: echo "::set-output name=date::$(date +'%Y_%m_%d_%H_%m')"
21+
- name: Get current date
22+
id: date
23+
run: echo "::set-output name=date::$(date +'%Y_%m_%d_%H_%m')"
2424

25-
# - name: Build Server Image
26-
# run: docker build -f ./apps/fastify-server/Dockerfile -t ${{secrets.DOCKER_HUB_USERNAME}}/rnm-server:${{ steps.date.outputs.date }} .
25+
- name: Build express-server Image
26+
run: docker build -f ./apps/express-server/Dockerfile -t ${{secrets.DOCKER_HUB_USERNAME}}/express-server:${{ steps.date.outputs.date }} .
2727

28-
# - name: Build react-client Image
29-
# run: docker build -f ./apps/react-client/Dockerfile -t ${{ secrets.DOCKER_HUB_USERNAME }}/rnm-react-client:${{ steps.date.outputs.date }} .
28+
- name: Build nestjs-server Image
29+
run: docker build -f ./apps/nestjs-server/Dockerfile -t ${{secrets.DOCKER_HUB_USERNAME}}/nestjs-server:${{ steps.date.outputs.date }} .
3030

31-
# - name: Login to DockerHub
32-
# uses: docker/login-action@v2
33-
# with:
34-
# username: ${{ secrets.DOCKER_HUB_USERNAME }}
35-
# password: ${{ secrets.DOCKER_HUB_PASSWORD }}
31+
- name: Build next-client Image
32+
run: docker build -f ./apps/next-client/Dockerfile -t ${{ secrets.DOCKER_HUB_USERNAME }}/next-client:${{ steps.date.outputs.date }} .
3633

37-
# - name: Push Backend Image to Docker Hub
38-
# run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/rnm-server:${{ steps.date.outputs.date }}
34+
- name: Build react-client Image
35+
run: docker build -f ./apps/react-client/Dockerfile -t ${{ secrets.DOCKER_HUB_USERNAME }}/react-client:${{ steps.date.outputs.date }} .
3936

40-
# - name: Push react-client Image to Docker Hub
41-
# run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/rnm-react-client:${{ steps.date.outputs.date }}
37+
- name: Login to DockerHub
38+
uses: docker/login-action@v3
39+
with:
40+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
41+
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
42+
43+
- name: Push express-server Image to Docker Hub
44+
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/express-server:${{ steps.date.outputs.date }}
45+
46+
- name: Push nestjs-server Image to Docker Hub
47+
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/nestjs-server:${{ steps.date.outputs.date }}
48+
49+
- name: Push next-client Image to Docker Hub
50+
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/next-client:${{ steps.date.outputs.date }}
51+
52+
- name: Push react-client Image to Docker Hub
53+
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/react-client:${{ steps.date.outputs.date }}

.github/workflows/github-actions.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: github-actions
1+
name: build-apps
22

33
on: [push]
44

@@ -16,7 +16,7 @@ jobs:
1616
uses: actions/checkout@v4
1717

1818
- name: Setup Node env
19-
uses: actions/setup-node@v3
19+
uses: actions/setup-node@v4
2020
with:
2121
node-version: ${{ matrix.node-version }}
2222
cache: 'yarn'

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@
55
## Features
66

77
- [Turborepo](https://turborepo.org/)
8-
- [React](https://reactjs.org/) v18, [NestJs](https://nestjs.com/) v14.1, [ExpressJS](https://expressjs.com/), [NestJS](https://nestjs.com/) v10.3
8+
- [React](https://reactjs.org/), [NestJs](https://nestjs.com/), [ExpressJS](https://expressjs.com/), [NestJS](https://nestjs.com/)
99
- 100% [Typescript](https://www.typescriptlang.org/)
1010
- [Prettier](https://prettier.io/) and Eslint setup alongside `pre-commit` hook.
1111
- [Mui](https://mui.com/) and [Redux](https://redux.js.org/) preconfigured.
1212
- [Dockerize](https://docs.docker.com/) images
1313
- Easy to customise
14-
- Github Actions to test apps & docker images build
14+
- Github Actions to build apps and publish their docker images
1515

1616
## Get Started
1717

apps/express-server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base Image
2-
FROM node:20-alpine3.18 as phase1
2+
FROM node:20-alpine3.18 AS phase1
33

44
WORKDIR /app
55

apps/express-server/README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,14 @@ Express JS Application with Typescript
66

77
```bash
88
# development
9-
$ yarn run dev
9+
$ yarn dev
1010

11-
# production mode
12-
$ yarn run start:prod
13-
```
11+
# build & run production code
12+
$ yarn prod
13+
```
14+
15+
### Features
16+
17+
- Express app configured
18+
- Preconfigured logger - [winston](https://www.npmjs.com/package/winston) for logging request and errors
19+
- Producion Dockerfile

apps/express-server/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
{
22
"name": "express-server",
3-
"author": "Nishant Kohli",
43
"version": "1.0.0",
4+
"author": "Nishant Kohli",
55
"private": true,
66
"scripts": {
77
"dev": "nodemon src/index.ts",
88
"build": "rimraf dist && tsc",
99
"start": "ts-node dist/index.js",
10-
"start:prod": "yarn build && yarn start",
10+
"prod": "yarn build && yarn start",
1111
"lint": "eslint --fix ."
1212
},
1313
"dependencies": {
1414
"cors": "^2.8.5",
15-
"dotenv": "^16.4.4",
16-
"express": "^4.18.2",
17-
"winston": "3.11.0"
15+
"dotenv": "^16.4.5",
16+
"express": "^4.19.2",
17+
"winston": "3.13.0"
1818
},
1919
"devDependencies": {
2020
"@types/cors": "^2.8.17",
2121
"@types/express": "^4.17.21",
22-
"@types/node": "^20.11.17",
23-
"eslint": "^8.56.0",
24-
"nodemon": "^3.0.3",
25-
"rimraf": "^5.0.5",
22+
"@types/node": "^20.14.9",
23+
"eslint": "^8.57.0",
24+
"nodemon": "^3.1.4",
25+
"rimraf": "^5.0.7",
2626
"ts-node": "^10.9.2",
2727
"tsconfig-paths": "^4.2.0",
2828
"typescript": "^5.3.3"

apps/nestjs-server/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ COPY --chown=node:node ./apps/nestjs-server apps/nestjs-server
2121
RUN yarn
2222

2323
# run server in prod env
24-
CMD ["yarn", "workspace", "nestjs-server", "start:prod"]
24+
CMD ["yarn", "workspace", "nestjs-server", "prod"]

apps/nestjs-server/README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
# development
99
$ yarn run dev
1010

11-
# production mode
12-
$ yarn run start:prod
11+
# build & run in production mode
12+
$ yarn run prod
1313
```
1414

1515
## Test
@@ -24,3 +24,8 @@ $ yarn run test:e2e
2424
# test coverage
2525
$ yarn run test:cov
2626
```
27+
28+
### Features
29+
30+
- Routes directory
31+
- Dockerfile

apps/nestjs-server/package.json

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
{
22
"name": "nestjs-server",
33
"version": "1.0.0",
4-
"description": "",
54
"author": "Nishant Kohli",
65
"private": true,
7-
"license": "UNLICENSED",
86
"scripts": {
97
"build": "nest build",
108
"dev": "nest start --watch",
119
"start": "NODE_ENV=production node dist/main",
1210
"start:debug": "nest start --debug --watch",
13-
"start:prod": "yarn run build && yarn run start",
11+
"prod": "yarn run build && yarn run start",
1412
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
1513
"test": "jest",
1614
"test:watch": "jest --watch",
@@ -19,27 +17,27 @@
1917
"test:e2e": "jest --config ./test/jest-e2e.json"
2018
},
2119
"dependencies": {
22-
"@nestjs/common": "^10.3.2",
23-
"@nestjs/core": "^10.3.2",
24-
"@nestjs/platform-express": "^10.3.2",
25-
"@nestjs/platform-fastify": "^10.3.2",
26-
"reflect-metadata": "^0.2.1",
20+
"@nestjs/common": "^10.3.10",
21+
"@nestjs/core": "^10.3.10",
22+
"@nestjs/platform-express": "^10.3.10",
23+
"@nestjs/platform-fastify": "^10.3.10",
24+
"reflect-metadata": "^0.2.2",
2725
"rxjs": "^7.8.1"
2826
},
2927
"devDependencies": {
30-
"@nestjs/cli": "^10.3.2",
31-
"@nestjs/schematics": "^10.1.1",
32-
"@nestjs/testing": "^10.3.2",
33-
"@nish1896/eslint-config": "^2.0.2",
28+
"@nestjs/cli": "^10.4.1",
29+
"@nestjs/schematics": "^10.1.2",
30+
"@nestjs/testing": "^10.3.10",
31+
"@nish1896/eslint-config": "^2.0.4",
3432
"@types/express": "^4.17.21",
3533
"@types/jest": "^29.5.12",
36-
"@types/node": "^20.11.17",
34+
"@types/node": "^20.14.9",
3735
"@types/supertest": "^6.0.2",
38-
"eslint": "^8.56.0",
36+
"eslint": "^8.57.0",
3937
"jest": "^29.7.0",
4038
"source-map-support": "^0.5.21",
4139
"supertest": "^6.3.4",
42-
"ts-jest": "^29.1.2",
40+
"ts-jest": "^29.1.5",
4341
"ts-loader": "^9.5.1",
4442
"ts-node": "^10.9.2",
4543
"tsconfig-paths": "^4.2.0",

apps/next-client/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ RUN yarn workspace next-client build
3131
# Expose the port Next.js app runs on (default is 3000)
3232
EXPOSE 3000
3333

34-
CMD [ "yarn", "workspace", "next-client", "start:prod" ]
34+
CMD [ "yarn", "workspace", "next-client", "start" ]

apps/next-client/README.md

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,6 @@
1-
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
1+
# next-client
22

3-
## Getting Started
3+
### Features
44

5-
First, run the development server:
6-
7-
```bash
8-
npm run dev
9-
# or
10-
yarn dev
11-
# or
12-
pnpm dev
13-
# or
14-
bun dev
15-
```
16-
17-
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
18-
19-
You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
20-
21-
This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
22-
23-
## Learn More
24-
25-
To learn more about Next.js, take a look at the following resources:
26-
27-
- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28-
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
29-
30-
You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
31-
32-
## Deploy on Vercel
33-
34-
The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
35-
36-
Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
37-
38-
Nextjs with Docker [example](https://github.com/vercel/next.js/tree/canary/examples/with-docker)
5+
- Integrated Mui with theme
6+
- Dockerfile

apps/next-client/package.json

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,33 @@
11
{
22
"name": "next-client",
33
"version": "1.0.0",
4+
"author": "Nishant Kohli",
45
"private": true,
56
"scripts": {
6-
"dev": "next dev",
7+
"dev": "next dev -p 3001",
78
"build": "next build",
8-
"start:prod": "yarn run build && next start",
9+
"start": "next start",
10+
"prod": "yarn run build && yarn run start",
911
"lint": "next lint --fix ."
1012
},
1113
"dependencies": {
1214
"@emotion/cache": "^11.11.0",
13-
"@emotion/react": "^11.11.3",
14-
"@emotion/styled": "^11.11.0",
15-
"@mui/icons-material": "^5.15.10",
16-
"@mui/material": "^5.15.10",
15+
"@emotion/react": "^11.11.4",
16+
"@emotion/styled": "^11.11.5",
17+
"@mui/icons-material": "^5.15.21",
18+
"@mui/material": "^5.15.21",
1719
"@mui/material-nextjs": "^5.15.11",
18-
"next": "14.1.0",
19-
"react": "^18.2.0",
20-
"react-dom": "^18.2.0"
20+
"next": "14.2.4",
21+
"react": "^18.3.1",
22+
"react-dom": "^18.3.1"
2123
},
2224
"devDependencies": {
23-
"@nish1896/eslint-config": "^2.0.2",
24-
"@types/node": "^20.11.17",
25-
"@types/react": "^18.2.55",
26-
"@types/react-dom": "^18.2.19",
27-
"eslint": "^8.56.0",
28-
"eslint-config-next": "14.1.0",
25+
"@nish1896/eslint-config": "^2.0.4",
26+
"@types/node": "^20.14.9",
27+
"@types/react": "^18.3.3",
28+
"@types/react-dom": "^18.3.0",
29+
"eslint": "^8.57.0",
30+
"eslint-config-next": "14.2.4",
2931
"typescript": "^5.3.3"
3032
}
3133
}

apps/react-client/Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Base Image
2-
FROM node:20-alpine3.18 as phase1
2+
FROM node:20-alpine3.18 AS phase1
33

44
WORKDIR /app
55

@@ -18,14 +18,14 @@ COPY --chown=node:node package.json .
1818
COPY --chown=node:node ./packages/core-lib/package.json packages/core-lib
1919
COPY --chown=node:node ./packages/core-lib packages/core-lib
2020

21-
COPY --chown=node:node ./apps/frontend/package.json apps/frontend
22-
COPY --chown=node:node ./apps/frontend apps/frontend
21+
COPY --chown=node:node ./apps/react-client/package.json apps/react-client
22+
COPY --chown=node:node ./apps/react-client apps/frontend
2323

2424
# install node_modules
2525
RUN npm install
2626
RUN yarn lib:build
2727

28-
# build frontend
28+
# build react-client
2929
RUN yarn build
3030

3131
# Phase 2 - Get the Build and host on nginx

0 commit comments

Comments
 (0)