Update on docker

This commit is contained in:
Dennis Eckerskorn 2025-05-29 00:07:32 +02:00
parent b52519979c
commit c59d9cb1be
3 changed files with 185 additions and 1082 deletions

File diff suppressed because it is too large Load Diff

View File

@ -19,7 +19,6 @@ services:
timeout: 5s timeout: 5s
retries: 5 retries: 5
backend: backend:
build: build:
context: ../memberflow-api context: ../memberflow-api
@ -37,8 +36,6 @@ services:
JWT_SECRET: c2VjdXJlc2VjdXJlc2VjdXJlc2VjdXJlMTIzNDU2 JWT_SECRET: c2VjdXJlc2VjdXJlc2VjdXJlc2VjdXJlMTIzNDU2
JWT_EXPIRATION: 7200000 JWT_EXPIRATION: 7200000
frontend: frontend:
build: build:
context: .. context: ..
@ -47,4 +44,14 @@ services:
depends_on: depends_on:
- backend - backend
ports: ports:
- "3000:80" - "3000:80"
db-restore:
image: mysql:8.0
depends_on:
mysql:
condition: service_healthy
volumes:
- ./backup.sql:/backup.sql
- ./docker/initdb.sh:/docker-entrypoint-initdb.d/initdb.sh
entrypoint: ["/bin/bash", "/docker-entrypoint-initdb.d/initdb.sh"]

8
docker/initdb.sh Normal file
View File

@ -0,0 +1,8 @@
#!/bin/bash
echo "Esperando a que MySQL esté disponible..."
until mysql -h mysql -u root -p1234 -e "SELECT 1" > /dev/null 2>&1; do
sleep 2
done
echo "Restaurando base de datos desde backup.sql..."
mysql -h mysql -u root -p1234 mf_db < /backup.sql