feat(Docker): Adding a working Dockerfile and compose to prototype

This commit is contained in:
Josepablo Cruz
2026-04-01 14:03:20 -06:00
parent 4fcd3f01a5
commit bd3fddbbc2
13 changed files with 723 additions and 51 deletions

View File

@@ -1,10 +1,6 @@
# ETAv2SQL
# MySQL Databse schema
![etaviaporte](./Models/assets/Modelv2.0.0.png)
# Docker
# Docker Container to deploy MySQL with schema and content init
## Build Docker image
@@ -20,3 +16,27 @@ docker logs -f eta-db
```
Container will generate automatically a SQL root password
### Environment Variables
You can setup a database name and grant access to it with user/password using the following env vars
- MYSQL_DATABASE
- MYSQL_USER
- MYSQL_PASSWORD
```{.sh}
docker run --name eta-db -e MYSQL_DATABASE=u947463964_etaviaporte -e MYSQL_USER=etaapi -e MYSQL_PASSWORD="secret_password" -d -p3306:3306 eta/eta-db
```
### Schemas and SQL scripts
You can add schemas and sql scripts to the container to setup the database on startup by mounting a directory with sql scripts on `/docker-entrypoint-initdb.d`
```{.sh}
docker run --name eta-db -e MYSQL_DATABASE=u947463964_etaviaporte -e MYSQL_USER=etaapi -e MYSQL_PASSWORD="secret_password" -v ./docker-entrypoint-initdb.d:/docker-entrypoint-initdb.d -d -p3306:3306 eta/eta-db
```
### Known Issues
- When loading a script, errors my araise when using `"` instead of `'` and when comments appear at the end of a command