Skip to content

Commit

Permalink
feat(docker): adicionar os arquivos Dockerfile e Makefile
Browse files Browse the repository at this point in the history
fix #10
  • Loading branch information
fejsrodrigues authored and PauloGoncalvesBH committed Apr 7, 2020
1 parent ba3462c commit 8664b6b
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 0 deletions.
34 changes: 34 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,40 @@ Utilizamos o [Better Code Hub](https://bettercodehub.com/) na análise da qualid

Caso o seu Pull Request reduza a pontuação do repositório, o mesmo será automaticamente reprovado.

## Execução do Projeto via Makefile

Com intuito de ajudar o desenvolvedor, criamos o arquivo Makefile para executar, build e parar o projeto usando o docker. Pode ser executados o seguintes comandos:

### Build
Pra fazer o build da imagem Docker com o projeto local, use o comando no terminal:
```sh
make build
```

### Build/run
Pra fazer o build e executar a imagem Docker com o projeto local, use o comando no terminal:
```sh
make build/run
```

### Run
Pra executar a imagem Docker com o projeto local, use o comando no terminal:
```sh
make run
```

### Stop
Pra parar a execução da imagem Docker com o projeto local, use o comando no terminal:
```sh
make stop
```

### Clean
Pra apagar a imagem Docker com o projeto local, use o comando no terminal:
```sh
make clean
```

## Documentação

A documentação, hospedada em https://serverest.js.org/, está toda concentrada dentro do diretório [docs/](./docs) e foi criada utilizando o [Docsify](https://docsify.js.org/).
Expand Down
13 changes: 13 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
FROM node:latest

WORKDIR /usr/src/app

COPY package*.json ./

RUN npm install --production

COPY . .

EXPOSE 3000

CMD [ "npm", "start" ]
19 changes: 19 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
.PHONY: build build\run run stop clean
# serverest

NAME_IMAGE=serverest
PORT=3000

build:
@DOCKER_BUILDKIT=1 docker build -t ${NAME_IMAGE}/${NAME_IMAGE} .

build/run: build run

run:
@docker run -p ${PORT}:3000 ${NAME_IMAGE}/${NAME_IMAGE}

stop:
@docker stop -t 0 $$(docker ps -q --filter ancestor=${NAME_IMAGE}/${NAME_IMAGE})

clean:
@docker rmi -f serverest/serverest

0 comments on commit 8664b6b

Please sign in to comment.