Skip to content

Upgrade libs #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jul 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 43 additions & 31 deletions .github/workflows/docker-img.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,53 @@
# name: ci
name: publish-docker-images

# on:
# push:
# branches:
# - 'main'
on:
push:
branches:
- 'main'

# jobs:
# docker:
# runs-on: ubuntu-latest
# steps:
# - name: Check out code
# uses: actions/checkout@v2
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v4

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

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

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

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

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

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

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

# - name: Push react-client Image to Docker Hub
# run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/rnm-react-client:${{ steps.date.outputs.date }}
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

- name: Push express-server Image to Docker Hub
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/express-server:${{ steps.date.outputs.date }}

- name: Push nestjs-server Image to Docker Hub
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/nestjs-server:${{ steps.date.outputs.date }}

- name: Push next-client Image to Docker Hub
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/next-client:${{ steps.date.outputs.date }}

- name: Push react-client Image to Docker Hub
run: docker push ${{ secrets.DOCKER_HUB_USERNAME }}/react-client:${{ steps.date.outputs.date }}
4 changes: 2 additions & 2 deletions .github/workflows/github-actions.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: github-actions
name: build-apps

on: [push]

Expand All @@ -16,7 +16,7 @@ jobs:
uses: actions/checkout@v4

- name: Setup Node env
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
## Features

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

## Get Started

Expand Down
2 changes: 1 addition & 1 deletion apps/express-server/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base Image
FROM node:20-alpine3.18 as phase1
FROM node:20-alpine3.18 AS phase1

WORKDIR /app

Expand Down
14 changes: 10 additions & 4 deletions apps/express-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,14 @@ Express JS Application with Typescript

```bash
# development
$ yarn run dev
$ yarn dev

# production mode
$ yarn run start:prod
```
# build & run production code
$ yarn prod
```

### Features

- Express app configured
- Preconfigured logger - [winston](https://www.npmjs.com/package/winston) for logging request and errors
- Producion Dockerfile
18 changes: 9 additions & 9 deletions apps/express-server/package.json
Original file line number Diff line number Diff line change
@@ -1,28 +1,28 @@
{
"name": "express-server",
"author": "Nishant Kohli",
"version": "1.0.0",
"author": "Nishant Kohli",
"private": true,
"scripts": {
"dev": "nodemon src/index.ts",
"build": "rimraf dist && tsc",
"start": "ts-node dist/index.js",
"start:prod": "yarn build && yarn start",
"prod": "yarn build && yarn start",
"lint": "eslint --fix ."
},
"dependencies": {
"cors": "^2.8.5",
"dotenv": "^16.4.4",
"express": "^4.18.2",
"winston": "3.11.0"
"dotenv": "^16.4.5",
"express": "^4.19.2",
"winston": "3.13.0"
},
"devDependencies": {
"@types/cors": "^2.8.17",
"@types/express": "^4.17.21",
"@types/node": "^20.11.17",
"eslint": "^8.56.0",
"nodemon": "^3.0.3",
"rimraf": "^5.0.5",
"@types/node": "^20.14.9",
"eslint": "^8.57.0",
"nodemon": "^3.1.4",
"rimraf": "^5.0.7",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "^5.3.3"
Expand Down
2 changes: 1 addition & 1 deletion apps/nestjs-server/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ COPY --chown=node:node ./apps/nestjs-server apps/nestjs-server
RUN yarn

# run server in prod env
CMD ["yarn", "workspace", "nestjs-server", "start:prod"]
CMD ["yarn", "workspace", "nestjs-server", "prod"]
9 changes: 7 additions & 2 deletions apps/nestjs-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
# development
$ yarn run dev

# production mode
$ yarn run start:prod
# build & run in production mode
$ yarn run prod
```

## Test
Expand All @@ -24,3 +24,8 @@ $ yarn run test:e2e
# test coverage
$ yarn run test:cov
```

### Features

- Routes directory
- Dockerfile
28 changes: 13 additions & 15 deletions apps/nestjs-server/package.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
{
"name": "nestjs-server",
"version": "1.0.0",
"description": "",
"author": "Nishant Kohli",
"private": true,
"license": "UNLICENSED",
"scripts": {
"build": "nest build",
"dev": "nest start --watch",
"start": "NODE_ENV=production node dist/main",
"start:debug": "nest start --debug --watch",
"start:prod": "yarn run build && yarn run start",
"prod": "yarn run build && yarn run start",
"lint": "eslint \"{src,apps,libs,test}/**/*.ts\" --fix",
"test": "jest",
"test:watch": "jest --watch",
Expand All @@ -19,27 +17,27 @@
"test:e2e": "jest --config ./test/jest-e2e.json"
},
"dependencies": {
"@nestjs/common": "^10.3.2",
"@nestjs/core": "^10.3.2",
"@nestjs/platform-express": "^10.3.2",
"@nestjs/platform-fastify": "^10.3.2",
"reflect-metadata": "^0.2.1",
"@nestjs/common": "^10.3.10",
"@nestjs/core": "^10.3.10",
"@nestjs/platform-express": "^10.3.10",
"@nestjs/platform-fastify": "^10.3.10",
"reflect-metadata": "^0.2.2",
"rxjs": "^7.8.1"
},
"devDependencies": {
"@nestjs/cli": "^10.3.2",
"@nestjs/schematics": "^10.1.1",
"@nestjs/testing": "^10.3.2",
"@nish1896/eslint-config": "^2.0.2",
"@nestjs/cli": "^10.4.1",
"@nestjs/schematics": "^10.1.2",
"@nestjs/testing": "^10.3.10",
"@nish1896/eslint-config": "^2.0.4",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.17",
"@types/node": "^20.14.9",
"@types/supertest": "^6.0.2",
"eslint": "^8.56.0",
"eslint": "^8.57.0",
"jest": "^29.7.0",
"source-map-support": "^0.5.21",
"supertest": "^6.3.4",
"ts-jest": "^29.1.2",
"ts-jest": "^29.1.5",
"ts-loader": "^9.5.1",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
Expand Down
2 changes: 1 addition & 1 deletion apps/next-client/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,4 @@ RUN yarn workspace next-client build
# Expose the port Next.js app runs on (default is 3000)
EXPOSE 3000

CMD [ "yarn", "workspace", "next-client", "start:prod" ]
CMD [ "yarn", "workspace", "next-client", "start" ]
40 changes: 4 additions & 36 deletions apps/next-client/README.md
Original file line number Diff line number Diff line change
@@ -1,38 +1,6 @@
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).
# next-client

## Getting Started
### Features

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

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.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.

Nextjs with Docker [example](https://github.com/vercel/next.js/tree/canary/examples/with-docker)
- Integrated Mui with theme
- Dockerfile
32 changes: 17 additions & 15 deletions apps/next-client/package.json
Original file line number Diff line number Diff line change
@@ -1,31 +1,33 @@
{
"name": "next-client",
"version": "1.0.0",
"author": "Nishant Kohli",
"private": true,
"scripts": {
"dev": "next dev",
"dev": "next dev -p 3001",
"build": "next build",
"start:prod": "yarn run build && next start",
"start": "next start",
"prod": "yarn run build && yarn run start",
"lint": "next lint --fix ."
},
"dependencies": {
"@emotion/cache": "^11.11.0",
"@emotion/react": "^11.11.3",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.15.10",
"@mui/material": "^5.15.10",
"@emotion/react": "^11.11.4",
"@emotion/styled": "^11.11.5",
"@mui/icons-material": "^5.15.21",
"@mui/material": "^5.15.21",
"@mui/material-nextjs": "^5.15.11",
"next": "14.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"next": "14.2.4",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"devDependencies": {
"@nish1896/eslint-config": "^2.0.2",
"@types/node": "^20.11.17",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"eslint": "^8.56.0",
"eslint-config-next": "14.1.0",
"@nish1896/eslint-config": "^2.0.4",
"@types/node": "^20.14.9",
"@types/react": "^18.3.3",
"@types/react-dom": "^18.3.0",
"eslint": "^8.57.0",
"eslint-config-next": "14.2.4",
"typescript": "^5.3.3"
}
}
File renamed without changes.
8 changes: 4 additions & 4 deletions apps/react-client/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base Image
FROM node:20-alpine3.18 as phase1
FROM node:20-alpine3.18 AS phase1

WORKDIR /app

Expand All @@ -18,14 +18,14 @@ COPY --chown=node:node package.json .
COPY --chown=node:node ./packages/core-lib/package.json packages/core-lib
COPY --chown=node:node ./packages/core-lib packages/core-lib

COPY --chown=node:node ./apps/frontend/package.json apps/frontend
COPY --chown=node:node ./apps/frontend apps/frontend
COPY --chown=node:node ./apps/react-client/package.json apps/react-client
COPY --chown=node:node ./apps/react-client apps/frontend

# install node_modules
RUN npm install
RUN yarn lib:build

# build frontend
# build react-client
RUN yarn build

# Phase 2 - Get the Build and host on nginx
Expand Down
Loading