Awesome Docker Compose samples
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
awesome-compose/nestjs
leofvo c88bba304d feat: added nestjs code base 2 years ago
..
.docker feat: added nestjs code base 2 years ago
app feat: added nestjs code base 2 years ago
README.md feat: added nestjs code base 2 years ago
compose.yml feat: added nestjs code base 2 years ago

README.md

Compose sample application

Use with Docker Development Environments

NestJS

Project structure:

.
├── compose.yaml
├── README.md
└── app
    ├── Dockerfile
    └── ...

compose.yaml

services:
  api:
    build:
      context: app
      target: production
    ports: # You should add the port you need to expose applicaiton if you change the default port
      - '3000:3000'

Make sure port 3000 on the host is not already being in use. Make sure you have already add the port you need to expose applicaiton if you change the default port

Deploy with docker compose

$ docker compose up -d
[+] Building 1.2s (18/19)
 => [internal] load build definition from Dockerfile
 => transferring dockerfile: 655B
...
[+] Running 1/1
 ⠿ Container nestjs-api-1  Started

Expected result

Listing containers must show one container running and the port mapping as below:

$ docker ps
CONTAINER ID   IMAGE        COMMAND                  CREATED         STATUS                            PORTS                                       NAMES
7573c6f216ed   nestjs_api   "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes (health: starting)   0.0.0.0:3000->3000/tcp, :::3000->3000/tcp   nestjs-api-1

After the application starts, navigate to http://localhost:3000 in your web browser. (if you didn't specify a port, the default port will be used.)

Stop and remove the containers

$ docker compose down
[+] Running 2/2
 ⠿ Container nestjs-api-1 Removed
 ⠿ Network nestjs_default  Removed