Skip to content

Commit

Permalink
Docker
Browse files Browse the repository at this point in the history
  • Loading branch information
Jean-Parra committed Sep 18, 2023
1 parent d2097ff commit 16c02b7
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 78 deletions.
18 changes: 15 additions & 3 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
# Ignorar archivos y directorios generados por Docker
# Ignorar los archivos de compilación de Scala
target/
docker-master/init.sql
docker-slave/init.sql
database-scala/target/
database-scala/project/

# Ignorar los archivos de configuración del IDE
.idea/
*.iml
*.ipr
*.iws

# Ignorar los archivos de registro
*.log

# Ignorar los archivos del sistema
.DS_Store
18 changes: 18 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Usar una imagen base oficial de Scala
FROM hseeberger/scala-sbt:8u222_1.3.5_2.13.1

# Definir el directorio de trabajo en el contenedor
WORKDIR /app

# Copiar los archivos del proyecto al contenedor
COPY . /app

# Compilar la aplicación
RUN sbt update
RUN sbt compile

# Exponer el puerto por el que se comunicará la aplicación
EXPOSE 8080

# Definir el comando para ejecutar la aplicación
CMD ["sbt", "run"]
File renamed without changes.
51 changes: 38 additions & 13 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,49 @@
version: '3'
version: '3.1'

services:
mariadb-master:
image: mariadb:latest
# Configuración del maestro MariaDB
db-master:
image: mariadb
command: --init-file /docker-entrypoint-initdb.d/init.sql
environment:
MYSQL_ROOT_PASSWORD: mysecretpassword
MYSQL_USER: replication_user
MYSQL_PASSWORD: replication_password
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
ports:
- "3306:3306"
volumes:
- ./docker-master/init.sql:/docker-entrypoint-initdb.d/init.sql
- db-master-data:/var/lib/mysql
- ./database:/docker-entrypoint-initdb.d

mariadb-slave:
image: mariadb:latest
# Configuración del esclavo MariaDB
db-slave:
image: mariadb
command: --init-file /docker-entrypoint-initdb.d/init.sql
environment:
MYSQL_ROOT_PASSWORD: mysecretpassword
MYSQL_USER: replication_user
MYSQL_PASSWORD: replication_password
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${MYSQL_DATABASE}
MYSQL_USER: ${MYSQL_USER}
MYSQL_PASSWORD: ${MYSQL_PASSWORD}
depends_on:
- db-master
ports:
- "3307:3306"
volumes:
- ./docker-slave/init.sql:/docker-entrypoint-initdb.d/init.sql
- db-slave-data:/var/lib/mysql
- ./database:/docker-entrypoint-initdb.d

# Configuración de la aplicación Scala
myproject:
build:
context: .
dockerfile: Dockerfile
ports:
- "8080:8080"
depends_on:
- db-master
- db-slave

volumes:
db-master-data:
db-slave-data:
5 changes: 0 additions & 5 deletions docker-master/Dockerfile

This file was deleted.

5 changes: 0 additions & 5 deletions docker-slave/Dockerfile

This file was deleted.

52 changes: 0 additions & 52 deletions docker-slave/init.sql

This file was deleted.

0 comments on commit 16c02b7

Please sign in to comment.