Skip to content

Commit

Permalink
feat: dockerizando app
Browse files Browse the repository at this point in the history
  • Loading branch information
MathMendesReis committed Sep 2, 2024
1 parent fad0004 commit 5bb81bd
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 103 deletions.
11 changes: 5 additions & 6 deletions .env.local
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
GEMINI_API_KEY=""
DB_HOST=shopper
DB_PORT=5432
DB_DATABASE_NAME=shopper
DB_USER=shopper
DB_PASSWORD=shopper
DATABASE_URL="postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}:${DB_PORT}/${DB_DATABASE_NAME}?schema=public"
POSTGRES_PASSWORD=shopper
POSTGRES_USER=shopper
POSTGRES_DB=shopper
POSTGRES_HOST=postgres
DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:5432/${POSTGRES_DB}?schema=public"
87 changes: 19 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,85 +1,36 @@
<p align="center">
<a href="http://nestjs.com/" target="blank"><img src="https://nestjs.com/img/logo-small.svg" width="120" alt="Nest Logo" /></a>
</p>

[circleci-image]: https://img.shields.io/circleci/build/github/nestjs/nest/master?token=abc123def456
[circleci-url]: https://circleci.com/gh/nestjs/nest
# 🌊 Teste Técnico – Desenvolvimento Web 🌊

<p align="center">A progressive <a href="http://nodejs.org" target="_blank">Node.js</a> framework for building efficient and scalable server-side applications.</p>
<p align="center">
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/v/@nestjs/core.svg" alt="NPM Version" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/l/@nestjs/core.svg" alt="Package License" /></a>
<a href="https://www.npmjs.com/~nestjscore" target="_blank"><img src="https://img.shields.io/npm/dm/@nestjs/common.svg" alt="NPM Downloads" /></a>
<a href="https://circleci.com/gh/nestjs/nest" target="_blank"><img src="https://img.shields.io/circleci/build/github/nestjs/nest/master" alt="CircleCI" /></a>
<a href="https://coveralls.io/github/nestjs/nest?branch=master" target="_blank"><img src="https://coveralls.io/repos/github/nestjs/nest/badge.svg?branch=master#9" alt="Coverage" /></a>
<a href="https://discord.gg/G7Qnnhy" target="_blank"><img src="https://img.shields.io/badge/discord-online-brightgreen.svg" alt="Discord"/></a>
<a href="https://opencollective.com/nest#backer" target="_blank"><img src="https://opencollective.com/nest/backers/badge.svg" alt="Backers on Open Collective" /></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://opencollective.com/nest/sponsors/badge.svg" alt="Sponsors on Open Collective" /></a>
<a href="https://paypal.me/kamilmysliwiec" target="_blank"><img src="https://img.shields.io/badge/Donate-PayPal-ff3f59.svg" alt="Donate us"/></a>
<a href="https://opencollective.com/nest#sponsor" target="_blank"><img src="https://img.shields.io/badge/Support%20us-Open%20Collective-41B883.svg" alt="Support us"></a>
<a href="https://twitter.com/nestframework" target="_blank"><img src="https://img.shields.io/twitter/follow/nestframework.svg?style=social&label=Follow" alt="Follow us on Twitter"></a>
</p>
<!--[![Backers on Open Collective](https://opencollective.com/nest/backers/badge.svg)](https://opencollective.com/nest#backer)
[![Sponsors on Open Collective](https://opencollective.com/nest/sponsors/badge.svg)](https://opencollective.com/nest#sponsor)-->
Este repositório contém o backend de um aplicativo projetado para gerenciar a leitura individualizada de
consumo de água e gás. Ele fornece APIs essenciais para a coletar informações de consumo, para facilitar a coleta da informação, o serviço utilizará IA para
obter a medição através da foto de um medidor.

## Description

[Nest](https://github.com/nestjs/nest) framework TypeScript starter repository.
## 🛠 Tecnologias Utilizadas

## Project setup
- **🟢 Node.js**: Ambiente de execução para JavaScript.
- **🔗 Prisma**: ORM para Node.js e TypeScript, facilitando o gerenciamento do banco de dados.
- **🐳 Docker**: Solução para desenvolvimento e execução de aplicativos em contêineres.
- **🐦 Nest**: Framework de alto desempenho para aplicações web em Node.js.
- **📦 PostgreSQL**: Banco de dados relacional robusto e eficiente.

```bash
$ npm install
```
## 🚀 Configuração Inicial Local

## Compile and run the project

```bash
# development
$ npm run start
```bash
docker network create "meterAI-network" &&
docker compose up -d
```

# watch mode
$ npm run start:dev

# production mode
$ npm run start:prod
```
Você poderá acessar o Swagger em <http://localhost:3000/api>.

## Run tests

```bash
# unit tests
$ npm run test

# e2e tests
$ npm run test:e2e

# test coverage
$ npm run test:cov
```
## Licença

## Resources
Este código está licenciado usando a
[licença MIT](./LICENSE).

Check out a few resources that may come in handy when working with NestJS:

- Visit the [NestJS Documentation](https://docs.nestjs.com) to learn more about the framework.
- For questions and support, please visit our [Discord channel](https://discord.gg/G7Qnnhy).
- To dive deeper and get more hands-on experience, check out our official video [courses](https://courses.nestjs.com/).
- Visualize your application graph and interact with the NestJS application in real-time using [NestJS Devtools](https://devtools.nestjs.com).
- Need help with your project (part-time to full-time)? Check out our official [enterprise support](https://enterprise.nestjs.com).
- To stay in the loop and get updates, follow us on [X](https://x.com/nestframework) and [LinkedIn](https://linkedin.com/company/nestjs).
- Looking for a job, or have a job to offer? Check out our official [Jobs board](https://jobs.nestjs.com).

## Support

Nest is an MIT-licensed open source project. It can grow thanks to the sponsors and support by the amazing backers. If you'd like to join them, please [read more here](https://docs.nestjs.com/support).

## Stay in touch

- Author - [Kamil Myśliwiec](https://twitter.com/kammysliwiec)
- Website - [https://nestjs.com](https://nestjs.com/)
- Twitter - [@nestframework](https://twitter.com/nestframework)

## License

Nest is [MIT licensed](https://github.com/nestjs/nest/blob/master/LICENSE).
53 changes: 24 additions & 29 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
version: '3.8'

services:
postgres:
container_name: postgres
image: postgres
ports:
- 5432:5432
env_file:
- .env
networks:
- meterAI-network
api:
container_name: shopper
image: node:20.15.1-slim
restart: always
tty: true
container_name: api-meterAI
image: node:18.18
depends_on:
- db
- postgres
ports:
- '3000:3000'
- 3000:3000
volumes:
- .:/usr/app
- /usr/app/node_modules
working_dir: '/usr/app'
environment:
- DB_HOST=${DB_HOST}
- DB_PORT=${DB_PORT}
- DB_DATABASE_NAME=${DB_DATABASE_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- PORT=${PORT}
- .:/usr/src/app
working_dir: '/usr/src/app'
command: >
sh -c "npm install &&
npm run build &&
npx prisma generate &&
npx prisma migrate dev &&
npm run start:prod"
db:
container_name: shopper-db
image: postgres
ports:
- '${DB_PORT}:${DB_PORT}'
environment:
- POSTGRES_PASSWORD=${DB_PASSWORD}
- POSTGRES_USER=${DB_USER}
npx prisma migrate deploy &&
npm run start:dev"
networks:
- meterAI-network
networks:
meterAI-network:
name: meterAI-network
external: true
driver: bridge

0 comments on commit 5bb81bd

Please sign in to comment.