feat(Docker): Adding a working Dockerfile and compose to prototype
This commit is contained in:
@@ -1,10 +1,6 @@
|
||||
# ETAv2SQL
|
||||
|
||||
# MySQL Databse schema
|
||||
|
||||

|
||||
|
||||
# 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
|
||||
|
||||
Reference in New Issue
Block a user