Last active
December 4, 2024 13:24
-
-
Save ArielSNunes/1f5c500379402929190f122667e2adc5 to your computer and use it in GitHub Desktop.
Basic Dockerfile and docker-compose.yml for NodeJS, with NestJS
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Environment variables declared in this file are automatically made available to Prisma. | |
| # See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema | |
| # Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB (Preview). | |
| # See the documentation for all the connection string options: https://pris.ly/d/connection-strings | |
| POSTGRES_PASSWORD= | |
| POSTGRES_USER= | |
| POSTGRES_DB= | |
| POSTGRES_HOST= | |
| POSTGRES_PORT= | |
| DATABASE_URL="postgresql://${POSTGRES_USER}:${POSTGRES_PASSWORD}@${POSTGRES_HOST}:${POSTGRES_PORT}/${POSTGRES_DB}?schema=public" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| services: | |
| db: | |
| image: postgres | |
| restart: always | |
| env_file: | |
| - .env | |
| volumes: | |
| - .docker/db:/var/lib/postgresql/data | |
| ports: | |
| - 5432:5432 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| FROM node:lts-alpine3.10 | |
| # Instala um bash no container | |
| RUN apk add --no-cache bash | |
| # Instala a CLI do NestJS | |
| RUN npm i -g @nestjs/cli | |
| # Instala um usuário node | |
| USER node | |
| # Diretório de trabalho dentro do container | |
| WORKDIR /home/node/app |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| yarn | |
| yarn start:dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment