Skip to content

Commit ba4db1c

Browse files
committed
feat: add docker compose dev env
Signed-off-by: Vitor Hugo Salgado <[email protected]>
1 parent c32047d commit ba4db1c

File tree

7 files changed

+38
-13
lines changed

7 files changed

+38
-13
lines changed

Makefile

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,15 @@ SHELL := /bin/bash
55
help:
66
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}' $(MAKEFILE_LIST)
77

8-
lint: ## Run all lint and code style tools
9-
npm run lint
10-
npm run prettier:ci
8+
up: ## Run a development environment with Docker Compose.
9+
@docker-compose -f ./deployments/dev/docker-compose.yml up
10+
11+
down: ## Stop Docker Compose development environment.
12+
@docker-compose -f ./deployments/dev/docker-compose.yml down
13+
14+
dev-clean: ## Clean Docker Compose development environment.
15+
@docker-compose -f ./deployments/dev/docker-compose.yml down --remove-orphans --volumes
16+
1117

1218
nvm: ## Install Node.js version described on .nvmrc
1319
[ -s "$$HOME/.nvm/nvm.sh" ] && . "$$HOME/.nvm/nvm.sh" && \

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,16 @@
11
<h1 align="center">Node.js Starter ToolKit</h1>
22

33
<p align="center">
4-
<img src="docs/assets/logo.png" alt="Logo" />
5-
<br/>
64
<i>Starter Project for a Node.js application using <strong>TypeScript</strong> with all boring stuff already configured.</i>
75
</p>
86

97
<p align="center">
108
<a href="https://github.com/vitorsalgado/create-nodejs-ts/actions/workflows/ci.yml">
119
<img src="https://github.com/vitorsalgado/create-nodejs-ts/actions/workflows/ci.yml/badge.svg">
12-
</a>&nbsp
13-
<a href="https://codecov.io/gh/vitorsalgado/create-nodejs-ts">
14-
<img src="https://codecov.io/gh/vitorsalgado/create-nodejs-ts/branch/main/graph/badge.svg?token=YA1LHGXU38"/>
15-
</a>&nbsp
10+
</a>
1611
<a href="https://github.com/prettier/prettier">
1712
<img src="https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square"/>
18-
</a>&nbsp
13+
</a>
1914
</p>
2015

2116
## Overview
@@ -50,7 +45,7 @@ The final folder will the parameter `destination` concatenated with parameter `a
5045
- Prettier
5146
- Standard Version
5247
- Nodemon
53-
- Docker
48+
- Docker | Docker Compose
5449

5550
## License
5651

build/docker/Dockerfile.dev

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM node:14.17.3
2+
WORKDIR /app
3+
CMD npm start

cmd/create-nodejs-ts/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ const Ignores = [
2121
'.yarn/install-state.gz',
2222
'cmd',
2323
'coverage',
24-
'deployments',
2524
'dist',
2625
'docs',
2726
'node_modules',

deployments/dev/docker-compose.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
version: '3.8'
2+
3+
services:
4+
dev-app:
5+
build:
6+
context: ./
7+
dockerfile: ../../build/docker/Dockerfile.dev
8+
container_name: nodejs-ts.dev-app
9+
volumes:
10+
- ../../:/app
11+
ports:
12+
- 8080:8080

src/index.spec.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1+
/**
2+
* This is a sample test suite.
3+
* Replace this with your implementation.
4+
*/
5+
16
import { spawn } from 'child_process'
27
import Path from 'path'
38

4-
describe('CMD - App', function () {
9+
describe('Example Test', function () {
510
it('should init without errors', async function () {
611
process.env.PORT = '0'
712

src/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/usr/bin/env node
22

3+
/**
4+
* This is a sample HTTP server.
5+
* Replace this with your implementation.
6+
*/
7+
38
import 'dotenv/config'
49
import { createServer, IncomingMessage, ServerResponse } from 'http'
510

0 commit comments

Comments
 (0)