Skip to content

Commit

Permalink
develop-v1
Browse files Browse the repository at this point in the history
	🚀 Adição do projeto inteiro no container

		- Conseguindo rodar o projeto localmente e via docker
		- Adição do product-ms no compose
		- Adição de DockerFile pra gerar a img do product-ms
		- Adição de scripts pra startar e parar a aplicação
  • Loading branch information
Eduardo committed Sep 12, 2021
1 parent a07b9d9 commit 6470914
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 2 deletions.
10 changes: 10 additions & 0 deletions dockerStart.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
cd "$(find ~ -type d -name product-ms-quarkus | head -1)"

mvn clean package -Dmaven.test.skip=true

docker image build -t product-ms-quarkus . -f ./src/main/docker/Dockerfile

docker-compose -f src/main/docker/docker-compose.yaml up -d product-ms-database
docker-compose -f src/main/docker/docker-compose.yaml up -d product-ms-quarkus

echo "containers gerados com sucesso!"
6 changes: 6 additions & 0 deletions dockerStop.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
docker container rm --force product-ms-quarkus && docker container rm --force product-ms-quarkus-database

docker image rm $(docker images 'product-ms-quarkus')
docker image rm $(docker images 'mongo')

echo "containers & suas imagens foram parados e removidos com sucesso!"
1 change: 0 additions & 1 deletion init.sh

This file was deleted.

18 changes: 18 additions & 0 deletions src/main/docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
FROM openjdk:11

ENV MONGODB_URL="mongodb://admin:admin123@product-ms-database:27015/product-ms"

WORKDIR /deployments

COPY target/quarkus-app/lib/ /deployments/lib/
COPY target/quarkus-app/*.jar /deployments/
COPY target/quarkus-app/app/ /deployments/app/
COPY target/quarkus-app/quarkus/ /deployments/quarkus/

CMD ["java", "-jar", "quarkus-run.jar"]

RUN ls -l /deployments

RUN echo '\n\n * * * Imagem gerada com sucesso * * * \n'


20 changes: 19 additions & 1 deletion src/main/docker/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,23 @@
version: '3'

services:
product-ms-quarkus:
image: product-ms-quarkus
container_name: product-ms-quarkus
ports:
- 9999:9999
expose:
- 9999
depends_on:
- product-ms-database
networks:
- bridge-network

product-ms-database:
image: mongo
command: mongod --port 27015
restart: always
container_name: product-ms-database
container_name: product-ms-quarkus-database
environment:
MONGO_INITDB_ROOT_USERNAME: admin
MONGO_INITDB_ROOT_PASSWORD: admin123
Expand All @@ -14,3 +26,9 @@ services:
- 127.0.0.1:27015:27015
expose:
- 27015
networks:
- bridge-network

networks:
bridge-network:
driver: bridge

0 comments on commit 6470914

Please sign in to comment.