diff options
| author | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2018-02-15 23:03:01 +0100 |
|---|---|---|
| committer | Fabian Mastenbroek <mail.fabianm@gmail.com> | 2018-08-14 16:37:00 +0200 |
| commit | f8df97d51d56e27ae880a2b5bd71149559e91b4a (patch) | |
| tree | 5f41ae508a1a9e30960836a77cbd48bebda302f6 | |
| parent | 0dfd05fe2763cac25f548b5afb96503786c7b579 (diff) | |
chore: Automatically import database schema in Docker image
This change will make the database image automatically import the schema
and test data.
| -rw-r--r-- | database/Dockerfile | 8 | ||||
| -rw-r--r-- | docker-compose.yml | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/database/Dockerfile b/database/Dockerfile new file mode 100644 index 00000000..0e933b40 --- /dev/null +++ b/database/Dockerfile @@ -0,0 +1,8 @@ +FROM mariadb:10.1 +MAINTAINER Fabian Mastenbroek <f.s.mastenbroek@student.tudelft.nl> + +# Import schema into database +ADD schema.sql /docker-entrypoint-initdb.d + +# Add test data into database +ADD test.sql /docker-entrypoint-initdb.d diff --git a/docker-compose.yml b/docker-compose.yml index ac4bc27f..2407e9ff 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,7 +29,9 @@ services: - PERSISTENCE_USER=opendc - PERSISTENCE_PASSWORD=opendcpassword mariadb: - image: mariadb:10.1 + build: + context: ./database + image: database restart: on-failure ports: - "3306:3306" # comment this line out in production |
