Skip to content

Commit

Permalink
Atualiza Dockerfile e docker-compose.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
borelanjo committed Feb 16, 2021
1 parent 4328b78 commit a3d9b3d
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 13 deletions.
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM maven:3.5.2-jdk-8-alpine AS MAVEN_BUILD
FROM maven:3.6.3-openjdk-15-slim AS MAVEN_BUILD
COPY pom.xml /build/
COPY src /build/src/
WORKDIR /build/
RUN mvn package -DskipTests

FROM openjdk:8-alpine
FROM openjdk:15-alpine
EXPOSE 8080
COPY --from=MAVEN_BUILD /build/target/*.jar app.jar
ENTRYPOINT ["java","-jar","/app.jar"]
61 changes: 50 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,57 @@
version: '3.3'

services:
app:
image: 'borelanjo/condominio:0.0.1-SNAPSHOT'

#############################################################
######################### DATABASES #########################
#############################################################

db-condominio:
image: 'mysql'
command: ["--log_bin_trust_function_creators=1"]
restart: always
networks:
- spring-boot-mysql-network
- condominio-network
environment:
MYSQL_DATABASE: 'db-condominio'
# So you don't have to use root, but you can if you like
MYSQL_USER: 'condominio'
# You can use whatever password you like
MYSQL_PASSWORD: 'hn+YgnVb9e=aXLmG'
# Password for root access
MYSQL_ROOT_PASSWORD: 'TN^8mE47TRn87f_4'
volumes:
- data-mysql-db:/var/lib/mysql
ports:
- "3306:3306"


#############################################################
######################### APP ###############################
#############################################################

condominio-app:
image: 'borelanjo/condominio:1.0.0'
networks:
- condominio-network
ports:
- "8080:8080"
depends_on:
- db
- db-condominio
environment:
SPRING_DATASOURCE_URL: jdbc:mysql://db:3306/condominio?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: root
SPRING_DATASOURCE_PASSWORD: root
SPRING_DATASOURCE_URL: jdbc:mysql://db-condominio:3306/db-condominio?createDatabaseIfNotExist=true&useSSL=false&allowPublicKeyRetrieval=true
SPRING_DATASOURCE_USERNAME: condominio
SPRING_DATASOURCE_PASSWORD: hn+YgnVb9e=aXLmG

db:
image: 'mysql'
networks:
- spring-boot-mysql-network
#############################################################
######################### NETWORK ###########################
#############################################################
networks:
condominio-network:
driver: "bridge"

#############################################################
######################### VOLUME ############################
#############################################################
volumes:
data-mysql-db:

0 comments on commit a3d9b3d

Please sign in to comment.