Skip to content

Commit

Permalink
build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Manik2708 authored and Manik2708 committed Jun 3, 2024
1 parent 2fc7289 commit d3d9770
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 3 deletions.
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
FROM node:18-alpine
RUN apk update && apk add curl
RUN npm install -g @nestjs/cli
WORKDIR /usr/src/app
COPY . .
Expand Down
21 changes: 21 additions & 0 deletions server-docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
version: "3"
services:
web:
build:
context: .
dockerfile: Dockerfile
user: "node:node"
ports:
- "3000:3000"
networks:
- hi-services
healthcheck:
test: curl --fail http://0.0.0.0:3000/health-check/container || exit 1
interval: 10s
timeout: 3s
retries: 3
start_period: 20s
container_name: hi-container
networks:
hi-services:
external: true
9 changes: 6 additions & 3 deletions src/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {
NestModule,
RequestMethod,
} from '@nestjs/common';
import { CassandraDatabaseQueries } from './Database/Cassandra/queries';
import { ConfessionsModule } from './Controllers/Confessions/confession.module';
import { OTPModule } from './Controllers/Otp/otp.module';
import { UserModule } from './Controllers/Users/user.module';
Expand All @@ -14,10 +13,9 @@ import { OTPController } from './Controllers/Otp/otp_controllers';
import { UserController } from './Controllers/Users/user_controller';
import { UserRoutes } from './Constants/route_paths';
import { ControllerPaths } from './Constants/contoller_paths';
import { InjectionTokens } from './Constants/injection_tokens';
import { casClient } from './service_containers';
import { ChatsModule } from './Controllers/Chats/chats.module';
import { RetrieveDataModule } from './Controllers/RetrieveData/retrieve_data.module';
import { GlobalControllers } from './global_controller';

@Module({
imports: [
Expand All @@ -27,6 +25,7 @@ import { RetrieveDataModule } from './Controllers/RetrieveData/retrieve_data.mod
ChatsModule,
RetrieveDataModule,
],
controllers: [GlobalControllers],
})
export class AppModule implements NestModule {
configure(consumer: MiddlewareConsumer) {
Expand All @@ -44,6 +43,10 @@ export class AppModule implements NestModule {
path: ControllerPaths.USER_CONTROLLER + '/' + UserRoutes.LOGIN,
method: RequestMethod.POST,
},
{
path: '/health-check/container',
method: RequestMethod.GET,
},
)
.forRoutes(ConfessionsController, OTPController, UserController);
}
Expand Down
13 changes: 13 additions & 0 deletions src/global_controller.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Controller, Get, Req, Res } from '@nestjs/common';
import express from 'express';

@Controller('health-check')
export class GlobalControllers {
@Get('container')
async containerHealthCheck(
@Req() req: express.Request,
@Res() res: express.Response,
) {
return res.status(200).send('Ok');
}
}

0 comments on commit d3d9770

Please sign in to comment.